Php updating a static variable

If you find that your nice, working closures break when you load your code to a hosted website, check for e Accelerator (e.g. Simple fixes include:* disabling e Accelerator and opcode caching* replacing e Accelerator with Zend's opcache* reverting to PHP 5.3Apparently, the e Accelerator project has solved this issue, but hosts move slowly so I recommend removing e Accelerator from the equation for now.

When using anonymous functions as properties in Classes, note that there are three name scopes: one for constants, one for properties and one for methods.

Anonymous functions are implemented using the Closure class.

Closures can also be used as the values of variables; PHP automatically converts such expressions into instances of the Closure internal class.

A lambda is object of class Closure, and assigning lambdas to variables has the same semantics as assigning object instance to variables.

Comments