The value is this: With type hinting:
function a(string $mystring, num $mynum, object $myobject) { } Without type hinting: function a($mystring, $mynum, $myobject) { if (!is_string($mystring)) { trigger_error('Parameter 1 of function a() must be a string.', E_USER_WARNING) ; } if (!is_int($mynum) and !is_float($mynum)) { trigger_error('Parameter 2 of function a() must be a number.', E_USER_WARNING) ; } if (!is_object($myobject) { trigger_error('Parameter 3 of function a() must be an object.', E_USER_WARNING) ; } } On Thu, 2008-01-03 at 13:51 -0800, Stanislav Malyshev wrote: > > There aren't two code models here at all. You can have a function > > parameter, or you can have a type-enforced function parameter. PHP > > So now to use such function you'd have to check your variables for > typing - otherwise your application blows up. And the type-checking > should be total - otherwise you miss some call to some function or some > code path bringing wrong value and your application blows up at runtime > - since static type checking is not available. Meaning, unless all of > your code is type-enforced, you'd have to write a wrapper around each > type-enforced function manually checking that wrong value didn't get in. > But you can do the same checks now, so what is the added value? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php