Interview Summary
Today, I went to the famous IT company in Beijing for a PHP programmer's interview. This is the first time in life, why not nervous? I'm not sick. No, it's called self-confidence.
The first is to do some pen test.
What is the data structure used for 1.MYSQL database indexing? What are the benefits of doing this?
You can refer to this blog post: http://blog.csdn.net/ant_ren/article/details/2932068
2. There are two strings A and B to determine if the B string appears in a. Do not consider case.
My answer is: Use the Stripos () function to solve the problem.
if (Stripos ($a, $b) >-1) echo "B in a"; Elseecho "B is not in a";
Expand:
But if the order is not considered, ask whether the characters in the B string all appear in a ...
Then we need to use a loop to solve it. The following solutions are available:
$b _arr = Str_split ($b); for (var $i =0, $len = count ($b _arr); $i < $len; + + $i) {if (Stripos ($a, $b _arr[$i]) ==-1) return False;return true;
3. Do you know the open source framework?
I wrote some of my own experience:
Laravel,php,jquery ...
4. Simply explain the session and cookie. Is turning off cookie,session available?
I wrote it fairly simple:
The session is stored on the server side and the cookie is stored on the client. There is no direct link between the two.
For access to other pages. Php_sessionid is placed as a temporary cookie on the browser side.
Every request made by the browser will be SessionID in the HTTP header to identify itself.
If a cookie is disabled, it is automatically placed behind the URL for delivery.
5. Database Optimization Scheme
Look for this yourself on the Internet.
6. Design a timer class to calculate the time the program is running and simply call it.
Here is the simple version.
Class Timer{private $t = 0;public function Start () {$this->t = Microtime (true);} Public Function Stop () {return Microtime (true)-$this->t;}} $time = new Timer (), $time->start (),//do somethings ... $t = $time->stop ();
7. Things to be aware of when building composite indexes.
(1) For a table, if there is a composite index on (col1,col2) It is not necessary to establish a single index on col1.
(2) If the query conditions require, can be in the case of a single index on col1, add Composite Index on (col1,col2), for a certain increase in efficiency.
(3) It is not particularly advantageous to build multiple fields (including 5, 6 fields) at the same time, and it is relatively possible to create more efficient and more flexible indexes with narrow fields (only one, or at most 2 fields).
8. Design a database table. This data table is used to store URL data that is frequently inserted and queried.
And explain why this design is the reason.
Create table URL (' id ' int (one) ' NOT null primary key auto_increment comment "PRIMARY key", ' url ' varchar (255) ' Not null comment ' URL content ", ' name ' varchar () comment" url corresponding to ") Engine=myisam
That's how I built it.
Often inserted and deleted, I feel that the database storage engine should use MyISAM.
It would be better if you were to build an index on the Url,name field again.
No, I want to write it down. So many questions on a piece of A4 paper AH.
Isn't that forcing me to write a little simpler? But I have made some low-level mistakes. I'm trying to correct it.
A little benefit to share with everyone.
Best Wishes.
http://www.bkjia.com/PHPjc/802113.html www.bkjia.com true http://www.bkjia.com/PHPjc/802113.html techarticle Interview Summary today went to Beijing famous IT company for PHP Programmer's interview. This is the first time in life, why not nervous? I'm not sick. No, it's called self-confidence. The first is to do some ...