1. Use PHP to print the previous day in the format of 10:11:22
echo date("",strtotime(""));
Format character [a: am, pm lower case, A: AM, PM upper case g hours, 12 hours before n months without 0]
The usage of strtotime () is as follows:
phpecho strtotime (""), "";echo strtotime (""), "";echo strtotime (""), "";echo strtotime (""), "";echo strtotime (""), "";echo strtotime (""), "";echo strtotime (""), "";
2. Differences between echo () print () print_f ()
Echo () is a php statement, so it can print simple data without returning values.
Print () is a function that has returned values and can print simple data.
Print_r () is a function that can print complex (mix) data.
3. Common PHP template Engines
Smarty EasyTemplatePHP
4. Tools for Version Control
SVN CVS
5. Character flip Function
Strrev ($ str );
6. Common Methods for optimizing Mysql Databases
(1 ). in terms of database design, this is the responsibility of DBA and impact ect. A database with a good design structure should be de-normalized when necessary (I don't know what the Chinese translation is ), some data redundancy is allowed to avoid JOIN operations to improve query efficiency.
(2 ). in terms of system architecture design, the table is hashed, and massive data is hashed into several different tables. fast and slow tables: only the latest data is retained. Slow tables are archived in history. cluster, Master server Read & write, slave server read only, or N servers, each machine is a Master
(3). (1) and (2) better than PHP Programmer's requirements. It doesn't matter. check whether there is any less index.
(4 ). write efficient SQL statements to see if there are any inefficient SQL statements, such as generating full connections to cartesian products, a large number of Group By and order by statements, and no limit. when necessary, encapsulate the database logic in the stored procedure of the DBMS. cache query results and explain each SQL statement
(5). All the results are required. Only necessary data is obtained from the database. For example, you can query the number of comments of an article, select count (*)... where article_id =? You can. Do not select *... where article_id =? Then msql_num_rows.
Send only required SQL statements. For example, if you modify only the title when modifying an article, update... set title =? Where article_id =? Do not set content =? (Large text)
(6). Use different storage engines when necessary. For example, InnoDB can reduce deadlocks. HEAP can increase the query speed by an order of magnitude.
7. Use PHP to obtain the Client IP address and Server IP Address
Client: $ _ SERVER ['remote _ ADDR '] Or getenv ('remote _ ADDR ');
Server: gethostbyname ("baidu.com ");
8. Modify the session survival time
<? Phpsession_start (); // save for one day $ lifeTime = 24*3600; setcookie (session_name (), session_id (), time () + $ lifeTime, "/");?>
9. Write the SQL statement for the top 10 people with the most posts. The following table is used: members (id, username, posts, pass, email)
SELECT username FROM membersGROUP BY id ORDER BY count(posts) DESC LIMIT 0 , 10
10. Briefly describe how to obtain the path of the script to be executed, including the obtained parameters.
echo $_SERVER['SCRIPT_FILENAME']."?".$_SERVER['QUERY_STRING'];
11. What is the difference between mysql_fetch_row () and mysql_fetch_array?
Mysql_fetch_row () retrieves a row of data from the result set associated with the specified result ID and returns it as an array. Each result column is stored in an array unit, and the offset starts from 0. Mysql_fetch_array () is an extension of mysql_fetch_row. In addition to storing data in an array as a digital index, you can also store data as an associated index and use the field name as the key name.
12. Determine the following output
$ Str1 = null; $ str2 = false; echo $ str1 = $ str2? '':''; // Equal $ str3 = ''; $ str4 = 0; echo $ str3 = $ str4? '':''; // Equal $ str5 = 0; $ str6 = ''; echo $ str5 = $ str6? '':''; // Not equal
13. Write the following results
php $test = ''; $abc = & $test; unset($test); echo $abc;
When you unset a reference, you just disconnect the binding between the variable name and the variable content. This does not mean that the variable content is destroyed.
----------- To be continued -------------