Whats new with PHP7?

PHP7 is latest version of PHP released in 2016.

Main Features of  PHP 7 are listed below:-

  1. Spaceship Operator(<=>):

    Spaceship operator is my favorite. This is the replacement of Ternary Operators, strcmp() or version_compare() or can say shorthand if/else. Simple example for this
    Before PHP7:
    function some_func($a, $b)
    return ($a < $b) ? -1 : (($a > $b) ? 1 : 0);

    In PHP7:
    function some_func($a, $b)
    return $a <=> $b;

  2. Abstract Syntax Tree (More Shorthand):

    PHP7 allowing more shorthand with null check :

    Before PHP7:
    $id = isset($_GET[‘id’]) ? $_GET[‘id’] : null;

    In PHP7:
    $id = $_GET[‘id’] ?? null;

  3. Performance:

    Improved performance: PHP 7 is up to twice as fast as PHP 5.6 . I believe on php.net please do the test yourself.

  4. Cleanups:

    Now, You will not be able to use ASP(<%) any more while you are in php mode.

  5. Mysql_* Removed:

    All mysql_* function has been removed. No more support for mysql_connect(), mysql_select_db() and many more…

This entry was posted in Development, Internet Marketing, MySql, PHP and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.