Re: [PHP] Newbie question about good coding practice [isset]
Curt Zirzow wrote: * Thus wrote K.Bogac Bokeer ([EMAIL PROTECTED]): When $var is 0? ? $var = 0; or $var = ''; $var = array(); $var = false; // Output: $var: $var not exists if ( $var ) echo '$var: $var existsbr'; else Curt or null -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question about good coding practice [isset]
if($var) do something; verses if(isset($var)) do something; The simple form if($var) seems to work fine and I see it in code often. Is there a good reason for using isset? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about good coding practice [isset]
if($var) do something; verses if(isset($var)) do something; The simple form if($var) seems to work fine and I see it in code often. Is there a good reason for using isset? Yes, if you don't use isset(), you may see notices (errors) if the variable is not set. This depends upon the error reporting settings of the server. However, if you use isset() you won't see notices regardless. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about good coding practice [isset]
When $var is 0? ? $var = 0; // Output: $var: $var not exists if ( $var ) echo '$var: $var existsbr'; else echo '$var: $var not existsbr'; // Output: isset(): var exists if ( isset($var) ) echo 'isset(): $var existsbr'; else echo 'isset(): $var not existsbr'; ? Larry E . Ullman wrote: if($var) do something; verses if(isset($var)) do something; The simple form if($var) seems to work fine and I see it in code often. Is there a good reason for using isset? Yes, if you don't use isset(), you may see notices (errors) if the variable is not set. This depends upon the error reporting settings of the server. However, if you use isset() you won't see notices regardless. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about good coding practice [isset]
* Thus wrote K.Bogac Bokeer ([EMAIL PROTECTED]): When $var is 0? ? $var = 0; or $var = ''; $var = array(); $var = false; // Output: $var: $var not exists if ( $var ) echo '$var: $var existsbr'; else Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php