Home >Backend Development >PHP Tutorial >Sharing some interview questions and answers for Tencent PHP programmers
3. Briefly explain what is the garbage collection mechanism of PHP? There is a reference count for the variable, and the variable is destroyed when the count reaches 0. 4. To enable the object to be looped like an array, the properties must be private. (PHP5 implementation of Iterator mode, write a class to implement the Iterator interface) I remember that objects can also be foreach, or use reflection. If you really want to implement the iterative pattern, look at the design pattern or how to write it in Java. 5. Please write a piece of php code to ensure that multiple processes can write to the same file successfully at the same time. Code:
6. What method do you use to check the execution efficiency of PHP scripts (usually script execution time) and database SQL efficiency (usually database Query time), and locate and analyze the bottlenecks of script execution and database query? Execution efficiency of PHP scripts 1. Timing in code script. 2. xdebug counts the number of function executions and the specific time for analysis. , it is best to use the tool winCacheGrind analysis 3. The online system uses strace to track specific system calls of related processes. Database SQL efficiency SQL's explain(mysql) enables slow query log to record slow queries. It usually depends on whether the database design is reasonable, whether the requirements are reasonable, etc. Want to join Tencent QQ? Master all the above interview questions, and then take your supplies and go to Tencent, haha! ! |