Most detailed and most complete PHP interview questions (with answers)

The contents of this article is about the most complete presentation of the most detailed PHP interview questions (with answers), has a certain reference value, now for everyone to share, there is a need of a friend for reference

 

Related Recommendation: 2019 PHP big interview questions summary (collection)

1, __ FILE__ What does it mean? (5 points)
full path and file name of the file. If the included file is returned that contains the file name. Since PHP 4.0.2 onwards, __ FILE__ always contains an absolute path, and in this previous versions sometimes contain a relative path.
2, how to obtain the IP address of the client? (5 min)                                                                                                                                                                                                                                                                                                                                                                                                                       3, write the page using the header function jump statement (5 minutes)                                                                                                                                                                                                                                                                                                                                                                                          4, $ str is a piece of html text, use regular expressions to remove all js script which (5 points)                                                                                                                                                                                                                                                                                                                                                            5. Write an array of nulls removed statement (5 points)                                                                                                                                                                                                                                                                                                                                                                                               the first method:                                                                                                                                                                                                                                                                                                                                                                                                                                                    The second method:                                                                                                                                                                                                                                                                                                                                                                                                                                                   6, write a function to get the current time stamp, and the day before the time of printing method (format: Year - When Day - Month: minutes: seconds) (5 points)                                                                                                                                                                                                                                                                                                                                7, a function to write php transcoding (5 points)                                                                                                                                                                                                                                                                                                                                                                                                          . 8, $ = str "1,3,5,7,9,10,20", what functions can be converted to an array containing the string str respective numbers ? (5 points)                                                                                                                                                                                                                                                                                                                     9, serialize () / unserialize ( ) function returns the (5 minutes)
explained serialize () and to unserialize () is in the manual php:
the serialize - generating denotes a stored value, the return value is a string, the character string contains the byte stream representation of value, without losing their type and structure, it may be stored in any place.
unserialize - Create PHP from a stored representation of the value of the
specific usage:                                                                                                                                                                                                                                                                                                                                                                                                                                                          // by any method: get stored (for example, if you exist now $ sarr you can get a text file with file_get_contents) value is stored in the $ newarr;                                                                                                                                                                                                                                                                         10, write a function, the parameters for the month and year, output the number of days specified month (5 points)                                                                                                                                                                                                                                                                                                                                                  11, a file path for /wwwroot/include/page.class.php, write way to get the file extension (5 points)                                                                                                                                                                                                                                                                                                                           12, which you have used PHP template engine? (5 points)
Smarty, thinkphp own template engine
13, simply write a class, instantiate this class, and write a statement calling the properties and methods of the class (5 points)                                                                                                                                                                                                                                                                                                                                 14, the local mysql database tables have been built in db_test friend, connected user database 123 is root, password
friend list fields: id, name, age, gender , phone, email
use php mysql connection, select the friend list age> 20 results print all the records and statistics of the total number of results of a query. (5 points)                                                                                                                                                                                                                                                                                          15, the following two tables
user table field ID (int), name (VARCHAR)
score table fields UID (int), Subject (VARCHAR), score (int)
ID field and the UID of the user table score table related field
Required to write the sql statement
1) in the user table of the newly inserted record, insert two records associated with the record newly added (5 min) in the score table
2) obtaining the highest score for the user table uid score of 2 5 records (5 points)
3) is used in conjunction query to get the name "John Doe" in the total score of the user (5 points)
4) delete the name as "John Doe" of users, including scores of records (5 points)
5) empty score table (5 points)
6) delete user table (5 points)                                                                                                                                                                                                

Guess you like

Origin www.cnblogs.com/programmer123/p/11695302.html