PHP Interview Knowledge

Source: Internet
Author: User
Tags echo date learn php
began to make PHP, a lot of php knowledge forgotten, the way to learn PHP is to look at the question

Here's a list of my PHP interview questions I've collected.

1. The time format of the day before printing with PHP is 2006-5-10 22:21:21 (2 minutes)
echo Date ("Y-m-d h:i:s", Strtotime ("1 day"));
2, Echo (), print (), Print_r () difference (3 points)
ECHO is a PHP statement that outputs one or more strings, with a relatively high echo efficiency and no return value.
Print and Print_r are functions that have return values.
Print only prints simple type variables (such as int,string, etc.) and can only output one string at a time.
Print_r can print complex type variables (such as arrays, objects, etc.)

3, the ability to make HTML and PHP separated from the use of the template (1 points)
Templatelib,smarty,.....

4. What tools are used for version control? (1 points)
More representative: Cvs,subversion

5, how to implement string rollover? (3 points)
Various ways, directly using PHP's Strrev function to implement string flipping. or write yourself:
$str = "hello,world!";
For ($i =strlen ($STR)-1; $i >=0; $i-) {
echo $str [$i];
}
echo "\ n";
6, optimize the MySQL database method. (4 points, more write more)
creating indexes; Optimizing database table structure
Use stored procedures;

7, the Meaning of PHP (give 1 points)
PHP:HYPERTEXT Preprocessor, the acronym for Hyper-text preprocessor

8. What is the function of MySQL to get the current time?, the function to format the date is (2 points)
Now (); Date ()
Select Date (now ())
Select Time (now ())

9, the implementation of the text string interception without garbled method. (3 points)
function Mysubstr ($str, $start, $len) {
$tmpstr = "";
$strlen = $len + $start;
for ($i = $start; $i < $strlen; $i + +) {
if (Ord (substr ($str, $i, 1)) > 0xa0) {
$tmpstr. = substr ($str, $i, 2);
$i + +;
}
else {
$tmpstr. = substr ($str, $i, 1);
}
}
return $tmpstr;
}
The next 4 questions are the use of their own, I am not here to answer (mainly some I do not know, hehe).
10. Have you ever used version control software? If you have the name of the version control software you are using? (1 points)
11. Have you ever used a template engine? If you have the name of the template engine you are using? (1 points)
12, please briefly describe your most proud of the development of the work (4 points)
13, for the large-volume website, what method do you use to solve the traffic problem? (4 points)

14. Use PHP to write the code showing client IP and server IP 1 points)
$server = getenv ("server_addr");
$server _ip = getenv ("server_addr");
$client _ip = $_server[' remote_addr ');
$client _ip = getenv ("Http_x_forwarded_for");
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)
The include is read in by the process part of the program flow control, when the program executes to the include ().
Require generally at the beginning of the program, the PHP program will be executed before the require () contains the file read into, making it part of the PHP program.
You can use Include_once () and require_once () instead.

16, how to modify the session's survival time (1 points).
$lifeTime = 24 * 3600;
Session_set_cookie_params ($lifeTime);
Sorry ah, this change to my home page, hehe.
17, there is a web address, such as the hearts of the blog home page: http://www.hongxincao.com/, how to get its content? ($/min)
$content = file_get_contents ("http://www.hongxincao.com");
Echo $content;

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 min)
Header ("http/1.0 401 Authorization Required");

Other PHP related interview topics

http://dason.blog.51cto.com/658897/498831
  • 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.