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:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 2:43 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]