'callable' was implemented as a typehint in 5.4
PHP 5.4.0 bietet eine ganze Reihe neuer Features:
$a = [1, 2, 3, 4];
oder
$a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];
.
foo()[0]
.
$this
.
<?=
ist nun immer verfügbar, unabhängig von der
short_open_tag php.ini Option.
(new Foo)->bar()
.
Class::{expr}()
Syntax wird nun unterstützt.
0b001001101
.
PHP 5.4 also allows to use arrays in switch:
<?php
$foo = 1;
$bar = 2;
switch([$foo, $bar]) {
case [1, 2]:
echo 'case 1';
break;
case [2, 2]:
echo 'case 2';
break;
case [3, 4]:
echo 'case 3';
break;
}
// Will output "case 1"
?>
As of PHP 5.4, the CLI (using readline) no longer dies on fatal errors (for example calling undefined functions).