Php7:10 things you need to know.

Source: Internet
Author: User
Tags php language php class php 7 features php tutorial scalar zend zend framework

Are you a web developer or site owner? Do your website php-enabledcms like Wordpress,drupal, Joomla or Magento run? Then, I have good news for you: The new PHP 7 features a full beta version released recently. 7.0.0 has a lot of cool features in the major release, and we decided to dedicate it to the whole post. But first, we need to swipe in several reminders. The following is the PHP tutorial content:
It is important to note that PHP 7 is still in development, so do not use it in production until November, when the final version will be released. If-as a future user-you want to leverage your fair share of the development process, you can help download the latest beta version, play it in your surroundings and report the defects you found during the testing process. In order to find out in the next test will be out, here's the project schedule.
With this way, let's take a look at Php 7.
1.php Tutorial-Name of PHP 7 (6 not)
The current stable release version uses the version number 5.6 PHP. After a dispute, the development team decided that they would omit the next major version of PHP 6. PHP 6 already exists in a previous experimental project, but never reached the production stage.
To prevent user confusion before attempting to use the latest developments, the new major version will run in the name of PHP 7.


IMAGE: The era of software development
2. Brand-new Zend Engine

The Zend engine has been powered by PHP since 1999, when it was introduced to the then new PHP4 version. Zend-Do not confuse with the Zend framework-is an open-source execution engine written in C language that interprets the PHP language. The php5.x series currently uses Zend Engine II's enhanced engine for the first time funtionality, and adds an extensible object model and a significant performance-enhancing language.

The PHP7 receives a new version of the Php#ng (next generation) code for the engine.



IMAGE: The speech of the ZendCon-2014 year
3. Twice times the speed
The most recognizable advantages of the new Phpng engine are significant performance gains. Phpng's development team reconstructed Zend Engine, significantly optimized memory usage and addedjust instant compile (JIT), which allowed compilation at run time, not before execution.
Results? You can see the performance benchmarks provided by the following Zend Performance teams. By using PHP7 not only your code will be executed faster, but you will also need fewer servers for the same user service.


IMAGE:Zend.com
4. Easy error Handling

To say the least, handling deadly and catching fatal errors is never an easy thing for a PHP programmer. The new engine exception will allow you to replace these classes and exception errors. If the exception is not captured, PHP will continue because it is at the current 5. The X-series returns the same fatal error.

The new \ \ Engineexception object does not extend the \ \ exception base class. This guarantees backward compatibility and results in the error handling of two different exceptions: conventional and engine exceptions.

To enable programmers to catch up to two, PHP7 introduced the name of \ Baseexception to a new shared parent class.


IMAGE:Wiki.PHP.Net
5.64-bit Windows system support

PHP is the lamp stack, which means that its native environment is an important member of Linux-but it can also run on Windows systems. The series 5. X has not yet provided 64-bit integer or large file support, so until now 64 builds are considered experimental.

PHP7 will change this because it introduces consistent 64-bit support, which means that these two native 64-bit integers and large files will be supported, allowing you to confidently run the language in the future on 64-bit Windows systems.



6. New spacecraft and air merger operations
The official name of the ship operator in conjunction with operation comparison. The new carrier symbol looks like this:<=> (kinda like a simplified spaceship if you imagine it's right).
The spacehip operator returns 0 if the two operands are equal, 1, if the left is larger,-1, and the larger if appropriate. It is also known as the three-way comparison operator, which already exists in popular programming languages such as Perl and Ruby.



IMAGE:Wiki.PHP.net
The empty merge operator is represented by a two question mark (? )。 You can use it when you want to check if something is present and return a default value if it doesn't. The knot returns the result of its first operand if it exists and is not empty, and in any other case, the second operand.
Here's how long it takes for the new operator to reduce the basic claims:


IMAGE:Wiki.PHP.net
7. Ability to make precise type declarations

Have you ever thought of declaring the return type of a function to prevent accidental return values? Then, the new PHP7 enables developers to improve their code quality with the help of return type declarations.

Describes a very simple use case where the Foo () function should return an array. See more complex examples here.



IMAGE:Wiki.PHP.net
For enhanced functionality, PHP 7 introduces 4 new type-declaration scalar types: integer, float, String, and Boolean. The new scalar type allows the developer to indicate that they expect an integer, floating-point number, String, or Boolean value to be returned. The new scalar type introduced by PHP 7 also prompts the parameter type, allowing developers to enforce the type of the parameter because of the support of the PHP 5.X series.
8. Add Anonymous Class
PHP 7, you can use anonymous classes, one already in other object-oriented languages, such as C # and Java proven practices. Anonymous class is a class without a name. It instantiates an object that has the same functionality as the named Class object.
The syntax is the same as the traditional PHP class that we use, only the name is missing. If anonymous classes are used well, they can speed up coding and execution time. Anonymous class excellent When a class is executed and in case, when a class does not require a record to be used only once.


IMAGE:Wiki.PHP.net
9. Easy to import the same namespace

The new group use claims feature will godsent those of you who want to import multiple classes from the same namespace. The new syntax cuts verbose, makes your code neat, easier on the eyes, and saves you a lot of typing time.

It will also be easier to read and debug the code, for groups to use the statement to help you determine the imports belonging to the same module.


IMAGE:Wiki.PHP.net
10. Clean room

The purpose of PHP7 is to make room for improvements, so it is necessary to get rid of many outdated features and old and unsupported server APIs and extensions. If you want to check what these details are, click here and here.

All of the removed items have been deprecated in PHP 5 one, and this is likely you haven't been using it for a long time. Note, however, that if you have an older version of PHP, the new PHP7 may break the code to run the inherited application.


The above is the PHP tutorial-PHP7 Note 10 points, learn more about PHP Video tutorial knowledge can be logged in class home education official inquiry to watch! Address: http://www.kokojia.com/

Php7:10 things you need to know.

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.