PHP5.3 new version features Analysis (1) _ PHP Tutorial

Source: Internet
Author: User
PHP5.3 new features (1 ). From php4 to php5, from personal frameworks to open-source frameworks, php has witnessed the development of a formal army from the shanzhai. Php6 is still brewing. I believe php5 will be used as a site for testing and testing. From php4 to php5, from personal framework to open-source framework, p witnessed the development of php from the shanzhai to the formal army. Php6 is still brewing. I believe php5 will be used as a site for testing and testing. Php5.3 is a milestone in php5 and has added many new features.

I personally feel that php functions are getting more and more, but the php syntax is getting ugly. sometimes new functions are added, and new functions bring problems. to solve the problem, we need to add new syntaxes to fix the problem. It is estimated that php uses the syntax to fix the problem for better parsing.

I. mysql-driven mysqlnd

For a long time, php has been connected to mysql through the mysql client, but now mysql officially launched the mysql client for php, and this mysqlnd effectively reduces memory usage and improves performance. For details, refer:

Http://dev.mysql.com/downloads/connector/php-mysqlnd/

Http://forge.mysql.com/wiki/PHP_MYSQLND

498) this. width = 498; 'onmousewheel = 'javascript: return big (this) 'src = "http://www.bkjia.com/uploadfile/2013/0904/20130904094555148.jpg" width = 480>

We can see that the use of mysqlnd removes the step of copying data from the mysql driver to the php extension. Mysqlnd uses copy-on-write, that is, to copy and read references during write.

Mysqlnd is already built in the source code of php5.3. during compilation, 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. libmysql is not required and is already built into the source code.

  1. It is more convenient to compile php. libmysql is not required and is already built into the source code.
  2. Use php to avoid copyright issues
  3. Use php memory management and support php memory limits (memory_limit)
  4. Only one copy of all data in the memory and two copies of libmysql. For more information, see
  5. Provides performance statistics to help analyze bottlenecks
  6. Mysqli supports persistent connections (persistent connections)
  7. Performance is definitely faster than libmysql
  8. Add Cache mechanism on driver layer

After reading so many features, there is a conflict. Can the PDO at the database abstraction layer bring out the features of different backend servers? If mysql is used as the database, is mysqli a better choice? I always think that mysqli is just an over-product, and PDO is the future.

II. Performance Improvement

  1. Md5 () improves performance by about 10%-15%.
  2. Better stack implementation in the engine, not clear
  3. Constants are saved in ROM (Constants moved to read-only memory ).
  4. Improved exception handling and reduced opcode
  5. Solved the problem of repeatedly opening include (require) _ once. Previously, I used static variables once and finally solved this problem.
  6. Binary files compiled with gcc4 will be smaller
  7. Overall performance improved by 5%-15%

Many people think that the bottleneck of web is db, so the performance of app applications does not matter. I think it is mainly because app expansion is much easier than db expansion, so it will lead to db bottlenecks, however, this does not mean that you do not have to worry about the performance of the app. after all, you still need to solve various problems in the app. as a programmer, writing high-quality code is the most basic requirement. The memory usage of the program is low and the execution speed is faster, which is very effective in high concurrency. sometimes you can change the implementation method to dozens of times higher, which is also normal, of course, I don't need to be too persistent if I have to pay a lot of gains. I think I must be aware of writing high-quality code.

III ,? : Operator

It is actually in js |, the returned result is not a logical type, but the value of the original variable, such as false? : 123 returns 123 instead of true. The syntax is a bit strange!1

Bytes. Php6 is still brewing. I believe php5 will be used as a site for testing and testing. P...

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.