Re: PHP 5.1

From: Date: Tue, 14 Jun 2005 13:54:43 +0000
Subject: Re: PHP 5.1
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-16666@lists.php.net to get a copy of this message
Ron Korving wrote: >> function ifsetor(&$var, $default = null) { >> return isset($var) ? $var : $default; >> } >> >> echo ifsetor($a, 'foo'); >> echo $a, $b; >> echo ifsetor($a, 'foo'); >> echo isset($a) ? 'is set' : 'not set'; >> >> expected result: >> >> foo >> Notice: Undefined variable: a in [...] >> Notice: Undefined variable: b in [...] >> foo >> not set >> >> actual result: >> >> foo >> Notice: Undefined variable: b in [...] >> foo >> not set > > No, ifsetor() is not possible in user land, because it generates notices, > and a php core function ifsetor() would not generate notices. That's really > the way it has to be. i see no notice produced by this ifsetor() -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet

« previous php.internals (#16666) next »