PHP interview questions, with my answers and Analysis (1) _ php skills

Source: Internet
Author: User
PHP interview questions, with my answers and Analysis (1) Interview Question 1
1. use PHP to print the time format of the previous day in the format of 22:21:21
2. differences between echo (), print (), and print_r ()
3. templates that can be used to split HTML and PHP
4. how to implement PHP and JSP interaction?
5. what tools are used for version control?
6. how to implement string flip?
7. optimize the MYSQL database.
8. Talk about transaction processing
9. how to achieve maximum load using apache + mysql + php
10. the method for intercepting Chinese strings without garbled characters is implemented.

Answer:

1. echo date ('Y-m-d H: I: S', strtotime ('-1 DAY '));

2. echo is a language structure and has no return value. The print function is basically the same as echo. The difference is that print is a function and has a return value. print_r is recursive printing and used to output array objects.

3. so much, in fact, PHP itself is a template engine, I used smarty, common also PHPLib, FastTemplate, Savant here has a template engine list: http://www.sitepoint.com/forums/showthread.php? T = 123769

4. the question is a bit vague. SOAP, XML_RPC, Socket function, and CURL can all achieve this. if PHP and Java are integrated, PHP has built-in this mechanism (if PHP and. NET integration. for example, $ foo = new Java ('Java. lang. system ');

5. CVS and SVN. SVN is known as the next generation of CVS and has powerful functions. However, CVS is a veteran with a high market share. I have been using SVN for a long time. The question is what tools are used. well, this may require the following answers: CVS Server on Apache as the Server, WinCVS as the client, and Subversion on Apache/DAV as the Server, tortoiseSVN is used as the client, or Subclipse is used as the client.

6. use the strrev function. if you are not allowed to use the built-in PHP function, write it yourself:
Function strrev ($ str)
{
$ Len = strlen ($ str );
$ Newstr = '';
For ($ I = $ len; $ I >=0; $ I --)
{
$ Newstr. = $ str {$ I };
}
Return $ newstr;
}

7. for political questions of the college entrance examination, write down all the knowledge points you know. my answer:
(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.

8. just as A programming language would have an example that promised Hello World, it would be an example that the textbooks in this database would all talk about A's transfer of $50 to B's account. just answer this question. as far as I know, MySQL enterprises seldom use MySQL for transaction processing. moreover, Oracle has acquired InnoDB.

9. refer to the answer to Question 7. the problem can be solved if the problem is solved.

10. hahaha, I guess the person who asked the question has been troubled by substr's Chinese character processing problem for a long time. have you still used the functions that are circulated on the Internet to match Chinese characters and then intercept them? in fact, there is a very simple solution: mb_substr ()

Interview Question 2
Var $ empty = '';
Var $ null = NULL;
Var $ bool = FALSE;
Var $ notSet;
Var $ array = array ();
1.
$ A = "hello ";
$ B = & $;
Unset ($ B );
$ B = "world ";
What is $?

2.
$ A = 1;
$ X = & $;
$ B = $ a ++;
What is $ B?


3.
$ X = empty ($ array );
What is $ x? True or false


4. have you used version control software? What is the name of the version control software you use?

5. have you used the template engine? What is the name of the template engine that you use?

6. Briefly describe your most proud development work.

7. What methods do you use to solve the traffic issue for websites with large traffic volumes?

8. use PHP to write the code that shows the client IP address and server IP address:

The answer is written again when the blog is updated.
Related Article

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.