Posted: Tue Aug 19, 2003 8:38 am
Which I feel is crazy and incredibly vauge. 0 and null are not the same. 0 is a value. null isn't.Coco wrote:(tho empty returns true if the value is 0 OR null)
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Which I feel is crazy and incredibly vauge. 0 and null are not the same. 0 is a value. null isn't.Coco wrote:(tho empty returns true if the value is 0 OR null)
Well, I rely on globals anywaynielsene wrote:Using that code, you will always "do something" and never "do something else"evilmonkey wrote:Code: Select all
$var=$_GET['somevar']; if (isset($var)){ //do something } else { //do something else }
$var is always set (its value might be empty, but....)
You would want to doi.e. you can't assign to a variable and expect it to be unset.....Code: Select all
if (isset($_GET['somevar']))
Also, and rather strangely, $var = '0'; is held to be empty by php as well as $var = 0 ..Coco wrote:(tho empty returns true if the value is 0 OR null)
That's why this thread can be summed up as:McGruff wrote:Also, and rather strangely, $var = '0'; is held to be empty by php as well as $var = 0 ..Coco wrote:(tho empty returns true if the value is 0 OR null)
Code: Select all
if( isset($_POST['blokes_name']) && !empty($_POST['blokes_name']) )
{ /* Do somethin' about it! */ }