- Strrev ($STR)
- {
- $len =strlen ($STR);
- $newstr = ";
- for ($i = $len; $i >=0; $i--)
- {
- $newstr. = $str {$i};
- }
- return $newstr;
- }
Copy Code15. The implementation of the text string interception without garbled method. Answer: MB_SUBSTR () 16. Use PHP to write a simple query, find all the names of "Zhang San" and print out the content
- Table name User
- Name Tel content Date
- Zhang 313,333,663,366 College Graduation 2006-10-11
- Zhang 313,612,312,331 Bachelor's degree 2006-10-15
- Zhang Si 021-55665566 secondary school 2006-10-15
- Answer: Select name,tel,content,date from user where name= ' Zhang San '
Copy Code17. How to use the following class and explain what the following means?
- Class Test
- {
- Get_test ($num)
- {
- $num =MD5 (MD5 ($num). " En ");
- return $num;
- }
- }
Copy CodeA: Usage: $get _test = new Test (), $result = $get _test->get_test (2); The $num variable is returned after two MD5, the 2nd time parameter in the MD5, after the first MD5 ($num) added en 18. Get the extension of a file using more than five different ways Requirements: dir/upload.image.jpg, find. jpg or JPG, A: Use more than five ways to get the extension of a file
1)
- Get_ext1 ($file _name)
- {
- Return STRRCHR ($file _name, '. ');
- }
- 2)
- GET_EXT2 ($file _name)
- {
- Return substr ($file _name, Strrpos ($file _name, '. '));
- }
- 3)
- GET_EXT3 ($file _name)
- {
- Return Array_pop (Explode ('. ', $file _name));
- }
4)
- GET_EXT4 ($file _name)
- {
- $p = PathInfo ($file _name);
- return $p [' extension '];
- }
- 5)
- GET_EXT5 ($file _name)
- {
- Return Strrev (substr (Strrev ($file _name), 0, Strpos (strrev ($file _name), '. '));
- }
Copy Code19. How to modify the session lifetime This library allows you to process and display a variety of formats, another common use is to make the document. Another option other than GD is ImageMagick, but the function library is not built into PHP and must be installed by the system administrator on the server A: In fact, the session also provides a function session_set_cookie_params (); To set the lifetime of the session, the function must be called before the session_start () function call:
-
- Save the day
- $lifetime = 24 * 3600;
- Session_set_cookie_params ($lifetime);
- Session_Start ();
- $_session["Admin"] = true;
- ? >
Copy Code20. Write a function that enables the following functions: the string "Open_door" is converted to "Opendoor", "make_by_id" to "Makebyid". 30. Give an example of how you can speed up the loading of a page in your development process. Generates a static htmlb. Generate XMLC. You can save variable parameters in text without using the database as far as possible without the database. Use Zend to accelerate a:
function test ($STR) {
- $arr 1=explode (' _ ', $str);
- $arr 2=array_walk ($arr 1,ucwords ());
$str = Implode (' ', $arr 1);
- Return Ucwords ($STR);
- }
- $aa = ' Open_door ';
- echo Test ($AA);
- ?>
Copy Code21. How do I get the content of a Web page address using PHP's environment variables? How do I get an IP address? Answer: $_servsr[' Request_uri '] $_server[' REMOTE_ADDR '] 22. Ask for the difference of two dates, for example, 2007-2-5 ~ 2007-3-6 Date Differential Answer: (Strtotime (' 2007-3-6 ')-strtotime (' 2007-2-5 '))/3600*24 23. The table has a B C three columns, implemented with the SQL statement: When column A is greater than column B, select column B otherwise select column B, when column B is greater than column C, select column C otherwise. A: Select Case is A>b then a else b end,case if B>c then B else C Endfrom test 24. Briefly describe the ways in which the SQL statement performance is optimized in the project, and in what ways do you analyze it? Answer: (1) Select the most efficient table name order (2) connection order in the WHERE clause (3) Avoid using ' * ' in the SELECT clause (4) Replace the HAVING clause with a WHERE clause (5) Improve SQL efficiency with intrinsic functions (6) Avoid using calculations on indexed columns. (7) Improve the efficiency of the group BY statement by filtering out unwanted records before group by. What is the difference between 25.mysql_fetch_row () and mysql_fetch_array ()? Mysql_fetch_row () stores a column of the database in a zero-based array, the first column in the array index 0, the second column at index 1, and so on. MYSQL_FETCH_ASSOC () stores a column of the database in an associative array, the index of the array is the column name, for example, my database query back to "First_Name", "last_name", "e-mail" three fields, the index of the array is "first _name "," last_name "and" email ". Mysql_fetch_array () can send back the values of Mysql_fetch_row () and MYSQL_FETCH_ASSOC () at the same time. 26. What does the following code do for you? Please explain. $date = ' 08/26/2003 ';p rint ereg_replace ("([0-9]+)/([0-9]+]/([0-9]+)", "\\2/\\1/\\3", $date); This is the conversion of a date from MM/DD/YYYY format to dd/mm/yyyy format. A good friend of mine told me that this regular expression can be disassembled into the following statement, for such a simple representation is actually no need to disassemble, purely for the convenience of explanation: Corresponds to one or more 0-9, followed by an oblique number $regexpression = "([0-9]+)/";//should be one or more 0-9, followed by another oblique number $regexpression. = "([0-9]+)/";//corresponds one or more 0-9$regexpression. = "([0-9]+)"; \\2/\\1/\\3 is used to correspond to parentheses, the first pair of parentheses is the month, What is 27.GD function library for? A: This library allows you to process and display a variety of formats, another common use is to make the document. Another option other than GD is ImageMagick, but the function library is not built into PHP and must be installed by the system administrator on the server 28. Please explain in your development process what method to speed up the loading speed of the page A: To use the server resources to open, timely shutdown server resources, database Add index, page can generate static, picture and other large file separate server. Use the Code optimization tool. 29. Prevent SQL injection vulnerability generally with the __addslashes___ function. What is the difference between a value in 30.php and a pass-through or address? A: The value of the argument is the value assigned to the parameter to the row parameter, so the modification of the parameter does not affect the value of the argument. An address is a special way of transmitting a value, except that he passes an address, not an ordinary one, such as an int. After the address, both the argument and the row parameter point to the same object 31. How to tell if a window has been masked by JavaScript a: Gets the return value of open (), or null if it is blocked 33. What are the ways you can solve traffic problems for large-volume websites? A: First, verify that the server hardware is sufficient to support current traffic Second, optimize database access. Third, prohibit the external hotlinking. Four, control the download of large files. V. Use different hosts to divert the main flow VI, using traffic analysis statistics software The above to share some PHP face questions and related answers, hope to help you. |