The development from php4 to php5, from personal framework to open source framework, witnessed the development of php from copycat to regular army. php6 is still in the process of being brewed, and I believe php5 will serve as a small test site for php6. php5.3 is a milestone for php5 and adds a lot of new features.
I personally always feel that PHP has more and more functions, but the syntax of PHP is getting more and more ugly. Sometimes new functions are added, and the new functions bring problems. In order to fix the problems, it is necessary to Add new syntax to fix it, frustrating. It is estimated that PHP uses syntax to fix the problem for better parsing.
1. mysql driver mysqlnd
For a long time, php has been connected to mysql through the mysql client, and now mysql has officially launched the php version of mysql client, and This mysqlnd effectively reduces memory usage and improves performance. For details, please see:
http://dev.mysql.com/downloads/connector/php-mysqlnd/
http://forge.mysql.com/wiki/PHP_MYSQLND
As can be seen from the picture, using mysqlnd eliminates the step of copying data from the mysql driver to the php extension. Mysqlnd uses copy-on-write, which means copy-on-write and read-reference.
mysqlnd has been built into the source code of php5.3. When compiling, use --with-mysql=mysqlnd, --with-mysqli=mysqlnd and --with-pdo-mysql=mysqlnd to install the mysqlnd driver.
Advantages of mysqlnd
It is more convenient to compile php, no need for libmysql, it is already built in the source code
After seeing so many features, I feel a bit contradictory. As a database abstraction layer, can PDO bring out the features of different backends? If you use mysql as the database, is mysqli a better choice? I always feel that mysqli is just an excessive product, and PDO is the future.
2. Performance improvement
Many people think that the bottleneck of the web is the db, so they don't care about the performance of the app. I think it is mainly because app expansion is much easier than db expansion, so the db bottleneck occurs, but this does not mean that we can ignore the app's performance. Performance, after all, will ultimately solve various problems in the app. As a programmer, writing high-quality code is the most basic requirement. Programs that use less memory and execute faster are very effective under high concurrency. Sometimes if you change the implementation method, it is normal to increase it dozens of times. Of course, if you have to pay a lot but gain little, Don't be too persistent. I think you must have the awareness to write high-quality code.
3. ?: operator
is actually || in js. The result returned is not a logical type, but the value of the original variable, such as false? : 123 returns 123, not true. The syntax is a bit weird! 1