From the future, a PHP JavaScript like Number class, with late static binding and operator overloading
PHP and operator overloading Not everyone knows that with PHP, and since 2006, it is possible to implement operator overloading, thanks to a PECL extension . One common PHP VS other language flame, is about PHP poor OOP expressiveness and power. Another common request from skilled PHP developers, is the possibility to create a class that is able to manage every situation during code execution. For example, try to think about a Number class, and try to use every native Magic method to perform a simple task like this one: $i = new Number(123); $i += 2; echo $i; // 125 Above code is simply not implementable with current version of PHP 5.2 or greater, if we do not install php_operator.so or .dll. Unfortunately, this extension is still experimental, and not documented at all. That is why I have created a full class, based entirely on this extension, and for this post only, compatible with PHP 5.2 (then, without usage of late static binding). The JavaScript like Number class Next code, is a...