PHP: My favourite new features in PHP 5.6 / 5.5 / 5.4 / 5.3

PHP 5.6

constant scalar expressions

http://php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs

Variadic functions

http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list

argument unpacking

http://php.net/manual/en/migration56.new-features.php#migration56.new-features.splat

large file uploads

http://php.net/manual/en/migration56.new-features.php#migration56.new-features.large-file

__debuginfo

http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo

PHP 5.5

OPcache extension bundled

http://php.net/manual/en/book.opcache.php

empty() supports arbitrary expressions

http://php.net/manual/en/function.empty.php

finally keyword

http://php.net/manual/en/language.exceptions.php

password hashing API

http://php.net/manual/en/ref.password.php

array and string literal dereferencing

http://php.net/manual/en/language.types.array.php

class name resolution via ::class

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class

foreach supports list()

http://th1.php.net/manual/en/control-structures.foreach.php#control-structures.foreach.list

array_column()

http://php.net/manual/en/function.array-column.php

generators

http://php.net/manual/en/language.generators.php
http://php.net/manual/en/class.generator.php

PHP 5.4

traits

http://php.net/manual/en/language.oop5.traits.php

short array syntax

http://php.net/manual/en/language.types.array.php

short tags always enabled

<?=

function array dereferencing

http://php.net/manual/en/language.types.array.php#example-102

class member access on instantiation

(new Foo)->bar()

callable type hint

http://php.net/manual/en/language.types.callable.php

htmlspecialchars() improvements

http://nikic.github.io/2012/01/28/htmlspecialchars-improvements-in-PHP-5-4.html

JsonSerializable interface

http://www.sitepoint.com/use-jsonserializable-interface/

E_STRICT errors are now covered by E_ALL

http://php.net/manual/en/function.error-reporting.php#refsect1-function.error-reporting-changelog

http_response_code

http://php.net/manual/en/function.http-response-code.php

PHP 5.3

namespaces

http://php.net/manual/en/function.http-response-code.php

anonymous functions, closures

http://php.net/manual/en/functions.anonymous.php
http://php.net/manual/en/class.closure.php

late static bindings

http://php.net/manual/en/language.oop5.late-static-bindings.php

__invoke()

http://php.net/manual/en/language.oop5.magic.php#object.invoke

nested exceptions

http://php.net/manual/en/exception.construct.php

predefined constant __DIR__

http://php.net/manual/en/language.constants.predefined.php#language.constants.predefined.changelog

short ternary operator

http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary

Post a Comment