On Sun, 2005-10-30 at 15:57, Ron Korving wrote:
> The function I used in my post does not generate an E_NOTICE, because a
> call-by-reference can be done with an unset variable (that can be set from
> the function).
> 
> <?php
>   error_reporting(E_ALL);
> 
>   function ifsetor(&$var, $value)
>   {
>     return (isset($var)) ? $var : $value;
>   }
> 
>   echo ifsetor($bla, 'test');
> ?>
> 
> This simply prints 'test' and shows no errors. In fact, a var_dump() on $bla
> will show that it's become NULL. Never mind this whole ifsetor() in
> userspace issue, because it's not applicable anyway, but just for the
> record, this function does not generate an E_NOTICE.

Yes but it does generate a null assigned $bla variable in the calling
scope... side effects, side effects, never know when they'll bite you in
the rear.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to