Re: null value and isset

From: Date: Wed, 28 Jan 2004 04:31:06 +0000
Subject: Re: null value and isset
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176006@lists.php.net to get a copy of this message
Hi, On Wed, 28 Jan 2004 11:17:52 +1100 (EST) <daniel@electroteque.org> wrote: > Hi there regarding out discussions before about using isset, i > set function params which are false intitalially as null ie > function foo ($bar = null) , anyway $bar remains true both ways > if i do isset($bar), i didnt notice this assuming it was ok, > now the scripts are buggered, it was originally like if($bar) > which worked fine. Is there a better way to check ? Hmm.. It's always FALSE here. (Unless there something wrong with my test code.) Here's what I used: (Run on the command line...) <?php function check_if_set ($my_null_variable = NULL) { if (isset($my_null_variable)) { echo 'Yes!'; } else { echo 'No!'; } } check_if_set(); echo "\n"; ?> -- - E - __________________________________________________ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/

« previous php.general (#176006) next »