News Archive
PhpRiot Newsletter
Your Email Address:

More information

Johannes Schluter's Blog: Scalar type hints in PHP trunk

Note: This article was originally published at PHPDeveloper on 9 August 2010.

As Johannes Schluter mentions in his latest blog post, another new feature has been added to the trunk of the PHP project - scalar type hints.

So in my blog series I try to cover all additions to PHP trunk so I have to mention scalar type hints.

He gives examples of both simple hinting (ensuring a value is a float) and a more complex example setting an attribute on a PDO connection (checking for an integer). Sample error messages are included as well. He also gives some advice on mixing strong and weak typing in your apps - it's like "opening a can of worms".