New features

PHP 5.4.0 offers a wide range of new features:

  • Support for traits has been added.
  • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.
  • <?= is now always available, regardless of the short_open_tag php.ini option.
  • Class member access on instantiation has been added, e.g. (new Foo)->bar().
  • Class::{expr}() syntax is now supported.
  • Binary number format has been added, e.g. 0b001001101.
  • Improved parse error messages and improved incompatible arguments warnings.
  • The session extension can now track the upload progress of files.
  • Built-in development web server in CLI mode.

Коментарии

Автор:
'callable' was implemented as a typehint in 5.4
2012-06-22 09:11:24
http://php5.kiev.ua/manual/ru/migration54.new-features.html
As of PHP 5.4, the CLI (using readline) no longer dies on fatal errors (for example calling undefined functions).
2012-07-27 14:01:59
http://php5.kiev.ua/manual/ru/migration54.new-features.html
Автор:
PHP 5.4 also allows to use arrays in switch:

<?php

$foo 
1;
$bar 2;

switch([
$foo$bar]) {
    case [
12]:
        echo 
'case 1';
        break;
    case [
22]:
        echo 
'case 2';
        break;
    case [
34]:
        echo 
'case 3';
        break;
}

// Will output  "case 1"
?>
2018-06-27 13:02:27
http://php5.kiev.ua/manual/ru/migration54.new-features.html

    Поддержать сайт на родительском проекте КГБ