100% agreed!

this makes much more sense then any of us was saying before.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com





-----Original Message-----
From: Mark Maggelet [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 25, 2001 5:01 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] isset()


On Sat, 24 Feb 2001 17:51:07 +0100, Christian Reiniger 
([EMAIL PROTECTED]) wrote:
>On Saturday 24 February 2001 17:18, PHPBeginner.com wrote:
>> in my preceding email I've written:
>>
>> if($var!='')
>>
>> will fix your all your worries without an intervention of a 
strings
>> function.
>
>Except that it will throw a warning in PHP4 if $var is not set.
>=> isset () should be used.

man, this is like the thread that will not die. isset() will return 
true for an empty string, which is not what he wants. the right thing 
to do is use

if((isset($var))&&($var!=""))

the isset on the left gets evaluated first so a warning is never 
thrown. to be even safer, you can go:

if((isset($var))&&(trim($var)!=""))

you do not want to use strlen() for the following reasons:
1) makes code unreadable -> very sloppy
2) overhead
3) it will give a warning when $var is not set (error_reporting 15 
only).



-- 
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]

Reply via email to