A small written interview experience, although a few simple questions, but I summarize here, also look up some information, to get some good answers, but also to help themselves grow.
1. Self-familiar HTTP status code and its significance
In fact, the answer is everywhere. It's also a record of our common HTTP status code
200: The requested return status is normal.
301:url permanent redirection.
302:url temporary redirection.
400: Error request.
401: Unauthorized access.
403: No access.
404: Not Found
500: Server error.
502:bad Gateway. Error gateways.
504:gateway Timeout, gateway timed out.
For detailed HTTP status code content, refer to the HTTP status code.
The difference between 2.include and require and include_once, require_once
Require a file is wrong, then the program will break execution and display a fatal error
Include a file if there is an error, then the program will not be the middle end, but continue to execute, and display a warning error.
To prevent duplicate ingestion of files, choose to use Include_once (), require_once ()
3.php garbage collection mechanism
The garbage collection mechanism used before PHP 5.3 is a simple "reference count", that is, each memory object is assigned a counter, when the memory object is referenced by a variable, counter 1; When the variable reference is removed, the counter-1; when the counter = 0 o'clock indicates that the memory object is not being used, the memory object is destroyed. Garbage collection is complete.
The problem with reference counting is that when two or more objects reference each other to form a ring, the counter of the memory object is not reduced to 0; At this time, this set of memory objects is useless, but cannot be recycled, resulting in memory leaks;
php5.3 started with a new garbage collection mechanism, based on reference counting, a complex algorithm was implemented to detect the existence of reference rings in memory objects to avoid memory leaks.
Refer to the PHP garbage collection mechanism for detailed explanations.
4.php Common magic methods and Magic constants
1). Magic Method:
Common Magic Methods
5. Passing values and passing references
Pass value: is to assign the value of the argument to the row parameter, then the modification of the row parameter will not affect the value of the argument
Pass-through reference: When a real address is passed through the parameter, both the row parameter and the argument are the same object, except that their name is different. Modification of the row parameter will affect the value of the argument
6. Fibonacci Sequence Recursion
1<?PHP2 functionTest$n){3 if($n>2){4 $array[$n-1] = Test ($n-1);5 $array[$n-2] = Test ($n-2);6 $array[$n] =$array[$n-1] +$array[$n-2];7 return $array[$n];8}ElseIf($n==2) {9 return1;Ten}ElseIf($n==1) { One return1; A } -}
PHP Written interview summary