Re: Search Engine a Problem...?

From: Date: Fri, 10 Nov 2000 22:59:31 +0000
Subject: Re: Search Engine a Problem...?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-24739@lists.php.net to get a copy of this message
> 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. --Joe 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! > > - Mark ================================================================================ = Joe Stump joestump98@yahoo.com http://www.miester.org = ================================================================================ "Real programmers don't comment their code. It was hard to write, it should be hard to understand."

« previous php.general (#24739) next »