Home > Article > Backend Development > PHP entry-level interview questions: Programming questions (2)
Title
PHP entry-level interview questions are for programmers with little experience who are just looking for a job. This will be helpful to us The interview provided a lot of help. The interviewer officer would often test us, and the interview questions played a big role at this time.
5. Use PHP to print out the time of the previous day, in a format such as 2006-5-10 22:21:21
strftime(“%Y-%m-%d %T”, strtotime(“-1 day”)); date(“Y-m-d H:i:s”, strtotime(“-1 day”));
Just 1 correct answer
#6. Write a function that can traverse All files and subfolders under a folder
function dir_recurse($dir) { $i = 1; if($handle = opendir($dir)) { while(false !== ($file = readdir($handle))) { if($file != "." && $file != ".." ) { if(is_dir($dir."/".$file) == true) { $fullpath = $dir."/".$file; dir_recurse($fullpath); echo "$fullpath\n"; $i++; }else { $fullpath = $dir."/".$file; echo "$fullpath\n"; $i++; } } } closedir($handle); } }
7. Linux creates the file exer1 and sets the access permission to rw-r--r--. Now To increase the execution permissions of all users and the write permissions of users in the same group, write the command
touch exer1 chmod 644 exer1 增加权限 chmod a+x exer1 chmod g+w exer1 或者 chmod 775 exer1
8, string "to upper case" uses php, shell, and js respectively to convert all the characters in the string into uppercase and output them.
Php实现: echo strtoupper(‘to upper case’)
Shell实现:echo "to upper case" | tr 'a-z' 'A-Z'
Js implementation:
<script language="javascript"> var stmp1 = " to upper case "; alert(stmp1.toLocaleUpperCase());//转换成大写 alert(stmp1.toUpperCase())//转换成大写 </script>
##9. Use Root login mysql database, if mydb does not exist, Create database mydb in mysql, Assign all permissions to the root user from 192.168 .1.1 ip to access the mysdb database. (The root user password is empty)
CREATE DATABASE IF NOT EXISTS mydb; grant all on mydb.* to root@’ 192.168.1.1’ identified by '' ;
10. Now you need to get a list in the following format by querying the database, and sort it by the number of replies. The one with the highest reply is ranked Please write the sql for the first "Article ID Article Title Clicks and Replies":
## The message field of Table 1 is as follows:
自increment id | |
Content | |
Category id |
|
Clicks |
|
Title |
reply id | |
The id in the associated message table | |
Reply content |
php Junior Interview Questions Programming Questions (1)
php Junior Interview Questions Brief Description Questions (5)
php Junior Interview Questions Brief Description Questions (4)
The above is the detailed content of PHP entry-level interview questions: Programming questions (2). For more information, please follow other related articles on the PHP Chinese website!