PHP 5.3 New features Analysis (1) _php tutorial

Source: Internet
Author: User
From PhP4 to PHP5, from the personal framework to the open source framework, the development of PHP from the cottage to the regular army. Php6 still in the brewing, I believe php5 will be as PHP6 small trial sledgehammer venue. php5.3 is a milestone in php5, adding a number of new features.

I personally feel the PHP function is more and more, but PHP syntax is more and more ugly, sometimes added new features, and new features brought problems, in order to fix the problem, but also add new syntax to fix, depressed. PHP is estimated to fix the problem with syntax for better parsing.

one, MySQL drive Mysqlnd

All along, PHP has been connected to MySQL through MySQL client, and now MySQL has officially launched the PHP version of the MySQL client, and this mysqlnd effectively reduce the use of memory and improve performance. Specific can be seen:

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>

As you can see, using MYSQLND is less of a step from copying data from MySQL drive to PHP extensions. MYSQLND uses Copy-on-write, that is, copy-on-write, read-reference.

Mysqlnd has been built into the php5.3 source code, compile the time using--with-mysql=mysqlnd 、--with-mysqli=mysqlnd and--with-pdo-mysql=mysqlnd install MYSQLND driver.

Advantages of MYSQLND

Compile php more convenient, do not need libmysql, has been built into the source code

    1. Compile php more convenient, do not need libmysql, has been built into the source code
    2. Use PHP licenses to avoid copyright issues
    3. Use PHP memory management, support PHP memory limit (memory_limit)
    4. All data in memory only one copy, before the Libmysql have two copies, refer to
    5. Provides performance statistics to help analyze bottlenecks
    6. MYSQLI supports long connections (persistent connections)
    7. Performance is definitely faster than Libmysql.
    8. Increase the caching mechanism in the drive layer

Looking at so many features, a bit contradictory, as the database abstraction layer of PDO can be different back-end features to play out? If MySQL is used as a database, is mysqli a better choice? I always think Mysqli is just an over-product, and PDO is the future.

Second, performance improvement

    1. MD5 () probably increased performance by 10% to 15%
    2. Better stack implementation in the engine, don't understand
    3. Constants are stored in ROM (Constants moved to read-only memory), which is not understood here.
    4. Improved exception handling, more concise opcode (opcode)
    5. Resolves an include (require) _once repeatedly open problem, before once I have been implemented with static variables, and finally solve the problem
    6. Binary files compiled with GCC4 will be smaller
    7. Improved overall performance with 5%-15%

Many people think that the web bottleneck in db, so the performance of the app does not care, I think the main reason is that the app extension is much easier than the db extension, so the db bottleneck, but this does not mean that you can not worry about the performance of the app, after all, ultimately in the app to solve a variety of problems, Writing high-quality code as a programmer is the most basic requirement. The memory usage of the program is small and the execution speed is fast, in high concurrency is very effective, and sometimes you change the implementation method, can improve dozens of times times is also very normal, of course, if you pay a lot of harvest very little time don't too persistent, I think must have to write high-quality code consciousness.

three,?: operator

In fact, is the JS | |, the returned result is not a logical type, but instead returns the value of the original variable, for example, false?: 123 returns 123 instead of true. Grammar is a little weird! 1

http://www.bkjia.com/PHPjc/446654.html www.bkjia.com true http://www.bkjia.com/PHPjc/446654.html techarticle From PhP4 to PHP5, from the personal framework to the open source framework, the development of PHP from the cottage to the regular army. Php6 still in the brewing, I believe php5 will be as PHP6 small trial sledgehammer venue. 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.