Scalar Type Hints in PHP 5.3.99

PHP 5.3.99, which will hopefully be released as PHP 5.4 in less than six months, introduces the concept of optional strict type checking for scalars. In a nutshell, this means that PHP 5.3.99 introduces new syntax -- scalar type hints -- but no new semantics. The latter can either be implemented as an extension written in C/C++, in userland PHP code, or in a tool that statically analyzes the code.

The code below shows how the Reflection API can be used to access the scalar type hint information in userland.

Update: The feature has been removed and will not be released.