PHP 5.4 Changes

by
Annika Backstrom
in misc, on 16 November 2011. It is tagged #Programming and #PHP.

From the PHP 5.4.0 RC1 "NEWS" file.

  • Traits
  • Class member access on instantiation: (new Foo)->bar()
  • Short array syntax: ['blue', 'red']
  • ext/mysql, mysqli and pdo_mysql now use mysqlnd by default
  • New typehint: function( callable $callback )
  • Closure::bind() and Closure::bindTo()
  • Class::{"foo$bar"}()
  • Method call through array: $cb = array($obj, 'method'); $cb( $args );
  • Built-in web server: php -S localhost:8080
  • <?= is now always available regardless of the short_open_tag setting (pure PHP templates ftw)

In addition to safe mode being removed, there's also this:

Removed magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase ini options. get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return false, set_magic_quotes_runtime raises an E_CORE_ERROR. (Pierrick, Pierre)