PHP face Test

Source: Internet
Author: User

1. The time format of the day before printing with PHP is 2006-5-10 22:21:21 (2 minutes)

$a = Date ("y-m-d h:i:s", Strtotime ("1 day"));p Rint_r ($a);

2, Echo (), print (), Print_r () difference (3 points) echo and print are not a function, it is a language structure int print (string $arg) with only one parameter echoaRG1, arg2; can output multiple parameters, return void Echo and print can only print out a string, cannot print out structure Print_r can print out structure such as $arr = Array ("Key" = "value");p Rint_r ($arr);

3, can make HTML and PHP separated from the use of the template (1 points) smarty,phplib

4. What tools are used for version control? (1 points) Svn,git,cvs

5, how to implement string rollover? (3 points) English: Strrev ($a) Chinese or other text: Chinese: GB2312, code is <?phpfunction reverse ($str) {$ret = "" Using GB2312 encoding);len=mbstrwidtH(str, "GB2312"); ForI=0;i< len; i++) {< Span id= "mathjax-span-39" class= "Mrow" >a rr []= m Bsu bs tr (str, $i, 1, "GB2312"); }return implode ("", Array_reverse ($arr));} Print_r (Reverse ("Hello"));

---------------------------------------------------------------6, the method of optimizing MySQL database. (4 points, write more) statement aspect: 1 use index, increase query Efficiency 2 query statement, improve index hit ratio database involved aspects: 1 structure Sub-database table, improve database storage and expansion capacity 2 use different storage engines as needed

7, php meaning (give 1 minutes) Super text preprocessing language hypertext preprocessor

8. What is the function of MySQL to get the current time?, the function to format the date is (2 minutes) Current_timestamp () date_format () Select Date_format ("2011-11-21 10:10:10", "%y-%m- %d ");

9, the implementation of the text string interception without garbled method. (3 points) Mb_substr ($STR, 1, 1, "GB2312");

10. Have you ever used version control software? If you have the name of the version control software you are using? (1 points) svngit

11. Have you ever used a template engine? If you have the name of the template engine you are using? (1 points) Smarty

12, please briefly describe your most proud of the development of (4 points) XXX

13, for the large-volume website, what method do you use to solve the traffic problem? (4 points) 1 use cache effectively, increase cache hit ratio 2 use CDN for static files to store and accelerate with load balancer 4 ideas to reduce the use of the database 5 see where the bottleneck of statistics is

-----------------------------------------------------------------14, write the code with PHP showing client IP and server IP 1 points) $_server["Remote_ ADDR "]$_server[" SERVER_ADDR "]

15. What is the difference between statement include and require? To avoid including the same file multiple times, you can use (?) Statements instead of them? (2 points) in the case of failure: include produces a warning, and require produces a direct error interrupt require loading the include at run time before running Require_onceinclude_once

16, how to modify the session's survival time (1 points). Session_set_cookie_params

17, there is a web address, such as the PHP Lab homepage: http://www.phpv.net/index.html, how to get its content? ($) File_get_contents Curl

18, in HTTP 1.0, the meaning of status code 401 is (?); If you get a hint that "file not found" is returned, the header function is available and the statement is (?);( 2 points) Unauthorized header ("http/1.0 404 Not Found"); Fast CGI: Header ("status:404 not Found");

19, in PHP, Heredoc is a special string, its end flag must? (1 points) a pair appears a $ A = <<eodgood Testeod;

20, talk about the advantages and disadvantages of asp,php,jsp (1 points) ASP is required to rely on IIS, Microsoft developed the language PHP and JSP can rely on Apache or Nginx and other servers
21. Please indicate the difference between the value of the transfer and the reference in PHP. When is the value passed? (2 points)
& Represents a reference
Parameter passing in a function changes the parameters
It is generally possible to consider using a reference when there are multiple output parameters
22. Please write a function to verify that the e-mail is in the correct format (2 points)
$STR = "[email protected]";
Regex= "([a−z0−9\.−]+) @ ([\da−z\.−]+) \. ([A−z\.] 2,6) "; Regular
Return Preg_match (REGEX,STR)
23. How to modify the lifetime of the session. (1 points)
Session_set_cookie_params

24. What is the difference between mysql_fetch_row () and mysql_fetch_array? (1 points)
Mysql_fetch_array () is an extended version of Mysql_fetch_row (). In addition to storing data as a numeric index in an array, you can store the data as an associated index, using the field name as the key name.

<?php
mysql_connect ("localhost", "Mysql_user", "Mysql_password") or
Die ("Could Not connect:". Mysql_error ());
mysql_select_db ("MyDB");

$result = mysql_query ("Select ID, name from mytable");

while (Row=mysqlfetcharray (result, Mysql_assoc)) {
printf ("ID:%s Name:%s", row["id"],row["name"]);
}

Mysql_free_result ($result);

PHP face Test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.