* Thus wrote Gerard Samuel:
> Im unable to find documentation on this.
> Does one exist? If so can you point me to it.
I dont think anything officially exist in the manual, yet. The type
hint can only be an Object, and will cause a fatal error if not the
paticular object isn't passed.
class Foo { };
function bar(Foo $foo) { }
$a = new Foo();
foo($a);
foo('a string'); // Fatal Error
The most useful use with type hinting can/is used is with
exceptions. The catch() requires a type hint of what class of
exception to catch:
try {
some_code();
}
catch (CustomException $e) {
}
catch (Exception $e) { // if CustomException isn't thrown
}
Curt
--
The above comments may offend you. flame at will.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php