RE: [PHP] variable functions: empty/isset/unset invalid?
| From: | Altunergil, Oktay | Date: | Mon, 07 May 2001 18:45:08 +0000 |
| Subject: | RE: [PHP] variable functions: empty/isset/unset invalid? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51795@lists.php.net to get a copy of this message | ||
Though I didn't know about 'variable functions' when answered, this is
exactly what I said.. Interesting :)
>>$foo is a string not a PHP function which makes 'empty' a string and not a
>>function/command.
>>
>>Am I missing something?
>>
>>oktay
-----Original Message-----
From: Philip Olson [mailto:philip@cornado.com]
Sent: Monday, May 07, 2001 2:43 PM
To: php-general@lists.php.net
Subject: RE: [PHP] variable functions: empty/isset/unset invalid?
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?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net