Lambda Functions, Closures, and __invoke

Posted on April 26th, 2009 by Sam

Previously, lambda-style functions were only possible by using create_function. This has one major disadvantage, the function is compiled at run time, opcode caches can’t cache the function at compile time. <?php   $func = create_function(’$a,$b’, ‘return "ln($a) + ln($b) = " . log($a * $b);’); echo "New anonymous function: $func\n"; echo $newfunc(2, M_E) . "\n"; [...]

Late Static Bindings

Posted on March 27th, 2009 by Sam

PHP 5.3 implements a feature called “late static bindings” that has been in the works since the PHP Developers Meeting that took place in November 2005 in Paris. This feature resolves an issue of inheritance, used to reference the called class in a context of static inheritance. Prior to version 5.3 a problem existed if [...]

What’s new in PHP 5.3

Posted on March 27th, 2009 by Sam

With PHP 5.3 slated for release near the end of April (Q1 2009), it’s time to start looking at the new improvements being implemented. Version 5.3 was originally known as “PHP 6 without Unicode support”, but there are many new features being implemented in this release that have been on the development table for a [...]

Announcing the Release of PHP 5.3 Candidate 1

Posted on March 26th, 2009 by Sam

The latest release of PHP (5.3.0RC1) is the final phase in a major improvement in the 5.X series. The PHP 5.3.X will eventually obsolete the 5.2.X branch of PHP; all users, primarily those using earlier version 5 releases, are advised to test this release for backwards compatibility. There is an upgrading guide available detailing the [...]

Namespaces

Posted on March 10th, 2009 by Sam

Namespace has been used in programming languages for quite a few years. Java uses them extensively, and many people have complained about the lack of namespace in PHP. Namespace was initially slated for PHP 5.0, but due to difficulties with its implementation, integration into the code base was postponed to version 5.3. With the release [...]