PHP's face test set, with my answers and analysis (i) _php skills

Source: Internet
Author: User
Interview Question 1
1, use PHP to print out the day before the format is 2006-5-10 22:21:21
2, Echo (), print (), Print_r () difference
3, can make HTML and PHP separated from the use of templates
4, how to implement PHP, JSP interaction?
5. What tools are used for version control?
6, how to implement string flip?
7, optimize the MySQL database method.
8. Talking about transaction processing
9, apache+mysql+php to achieve the maximum load of the method
10, the implementation of the text string interception without garbled method.

Answer:

1.echo date (' y-m-d h:i:s ', Strtotime ('-1 day '));

2.echo is a language structure with no return value; The print function is essentially the same as ECHO, unlike print, which is a function and has a return value; Print_r is a recursive print that outputs an array object

3.so much, in fact, PHP itself is a template engine, I used is smarty, common and phplib,fasttemplate,savant here is a list of template engines: Http://www.sitepoint.com/forums /showthread.php?t=123769

4. The topic is a little vague, soap,xml_rpc,socket function,curl can achieve these, if it is the test of PHP and Java integration, PHP built this mechanism (if you test the integration of PHP and. NET, you can also answer), such as $foo = New Java (' Java.lang.System ');

5.CVS and SVN,SVN are known as the next generation of CVS, powerful, but CVS is a veteran, the market is very high. I always use SVN, the topic is to ask what tools, er, this may need to answer: CVS Server on Apache as server, Wincvs as client; Subversion on Apache/dav Do the service side, TortoiseSVN do the client, or Subclipse to do the client.

6. Use the Strrev function chant, do not use PHP built on their own write:
function Strrev ($STR)
{
$len =strlen ($STR);
$newstr = ';
for ($i = $len; $i >=0; $i-)
{
$newstr. = $str {$i};
}
return $newstr;
}

7. The university entrance Examination Politics question, writes you to know the knowledge point. My answer:
(1). Database design, this is the responsibility of the DBA and architect, the design of a good database, when necessary, to formalize (English is this: denormalize, Chinese translation into what I do not know), allow partial data redundancy, avoid join operation, in order to improve query efficiency
(2). System architecture design, table hash, the mass of data into a number of different tables. Speed meter, quick watch only the latest data, slow table is a historical archive. Cluster, primary server Read & write, from server read only, or n servers, each machine is master
(3). (1) and (2) beyond the requirements of PHP programmer, will be better, it will not matter. Check for less index
(4). Write efficient SQL statements to see if there are any inefficient SQL statements, such as a full connection to a Cartesian product, a large number of group by and order by, no limit, and so on. When necessary, the database logic is encapsulated into the DBMS-side stored procedure. Cached query results, Explain every SQL statement
(5). All you have to do is get the necessary data from the database, such as querying the comments for an article, select COUNT (*) ... where article_id =? On it, don't first select * ... where article_id =? Then Msql_num_rows.
Transfer only the necessary SQL statements, such as modifying the article, if the user only modified the title, then update ... set title =? where article_id =? Do not set content =? (large text)
(6). Use a different storage engine when necessary. For example, InnoDB can reduce deadlocks. Heap can increase the query speed by one order of magnitude.

8. As a programming language would have promised Hello World example, is the textbook of this database will tell A to B account transfer 50 Dollar example, answer this. But as far as I know, with MySQL business, MySQL is rarely used to implement transactions. Besides, Oracle has now acquired InnoDB's company.

9. See the answer to question seventh, the problem is solved in that place.

10. Hahaha, I guess the question is not the substr of Chinese to deal with the problem for a long time, is not also used to spread the internet with the regular matching Chinese characters and then intercept the function, 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 = & $a;
Unset ($b);
$b = "World";
What is $a?

2.
$a = 1;
$x = & $a;
$b = $a + +;
What is $b?


3.
$x = Empty ($array);
What is $x? True or False


4. Have you ever used version control software? What is the name of the version control software you are using?

5. Have you ever used a template engine? What if you have the name of the template engine you're using?

6. Please give a brief description of your most proud development.

7. What methods do you use to address traffic problems for large traffic sites?

8. Write the code to display client IP and server IP in PHP:

The answer is to update the blog time to write again.

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.