RE: [PHP] variable functions: empty/isset/unset invalid?

From: Date: Mon, 07 May 2001 18:43:00 +0000
Subject: RE: [PHP] variable functions: empty/isset/unset invalid?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51794@lists.php.net to get a copy of this message
Solved. empty, isset and unset are not functions, they are language contructs, which results in the error. This makes sense, a workaround is creating functions like isEmpty (or something similar) and using them. I'll be submitting a future request soon ;) Thanks everyone, especially OpenSrc in #php regards, Philip <snip> > > <?php > > > > // works > > if (empty($var)) print '$var is empty<br>'; > > > > // works > > $foo = 'is_string'; > > $var = 'abcdef'; > > if ($foo($var)) print '$var is a string<br>'; > > > > // works > > $foo = 'strlen'; > > $var = 'abcdef'; > > if ($foo($var) > 5) print '$var is over 5 chars<br>'; > > > > // doesn't work : Fatal Error : Call to undefined function: empty() > > // same with isset() and unset() > > $foo = 'empty'; > > if ($foo($var)) print '$var is empty'; > > > > ?> > > > > In otherwords, only these few functions aren't working as "variable > > functions" but result in a "Fatal Error" instead. Why?

« previous php.general (#51794) next »