Re: what happened to that new isset() like language

From: Date: Mon, 31 Oct 2005 01:17:38 +0000
Subject: Re: what happened to that new isset() like language
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-19853@lists.php.net to get a copy of this message
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. | `------------------------------------------------------------'

« previous php.internals (#19853) next »