PHP 5.3: The Good, the Bad and the Ugly
June 30, 2009 by Glen. Filed under php.
PHP 5.3 was released today; here are my positive and negatives:
The Good: Closures
Anonymous functions created with create_function have always been a bit messy. With 5.3 comes support for closures with a much cleaner syntax:
$greet = function($name)
{
printf("Hello %s\r\n", $name);
};
$greet('World');
$greet('PHP');
The Bad: Backwards incompatible changes
Although not a massive change from 5.2, there are enough differences to break existing code.
The Ugly: Namespaces
There has been quite a discussion about PHP’s new namespace syntax.
$c = new \my\name\MyClass;
It’s just damn ugly. The more sensible choice, :: is already used as the scope resolution operator and was therefore dismissed.
Tags: php
Add a comment