On Sun, 2008-01-06 at 20:02 +0000, Mikko Koppanen wrote:
> >
> > Why I mean by:
> > Type HINTING is not type ENFORCEMENT.
> > is that:
> > function foo(int $a) {}
> >
> > foo(1); // OK
> >
> > foo("1"); // OK - the string is juggled to an int when the
> > function is called
> > // ENFORCEMENT would have (in some interpretations)
> > caused this to
> > // FAIL since the function argument was a string.
> >
>
>
> I have not been following very closely this conversation so this might have
> been answered already:
>
>
> $b = '5';
>
> function foo( int &$a )
> {
> echo gettype( $a );
> }
>
> foo( $b );
>
> echo gettype( $b );
>
>
> what is type of $b after the function call?
>
It won't get there. By calling foo with a string '5', an error will be
thrown.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php