Re: Search Engine a Problem...?
| From: | Mark Maggelet | Date: | Sat, 11 Nov 2000 00:20:20 +0000 |
| Subject: | Re: Search Engine a Problem...? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24747@lists.php.net to get a copy of this message | ||
On Fri, 10 Nov 2000 14:59:31 -0800, Joe Stump (joe@earth.care2.com)
wrote:
>> isset() shouldn't fail for 0. Maybe you had an old and buggy
>>version
>> of php?
>
>PHP 4.0.3
>
>> this will give a warning is $start isn't set!
>> use isset(), it's safer. less overhead too I would think.
>
>No it won't - I use it all the time. empty() WILL fail on 0 (note my
>code
>below) and isset sometimes acts wierd with 0 in the variable.
>strlen() has
>NEVER failed on me, while I have experienced such oddities. I'm
>willing to take
>a .000000000000000001 ms hit for rock solid performance anyday.
It will give a warning, but you may be supressing them with
error_reporting. try error_reporting(15). Sticklers like me set it at
15 and leave it there for maximum debugging.
>CODE:
>
><?
>
>$var = 0;
>
>if(isset($var)){
> echo 'set!'."\n";
>}
>
>if(empty($var)){
> echo 'empty!'."\n";
>}
>
>?>
>
>Return:
>
>[jstump@professorx vw]$ php -v
>4.0.1pl2
>[jstump@professorx vw]$ php -q foo.php
>set!
>empty!
But this is what's supposed to happen! How is this a failure?
- Mark