note 21515 deleted from control-structures by torben
| From: | torben@php.net | Date: | Wed, 15 May 2002 20:16:15 +0000 |
| Subject: | note 21515 deleted from control-structures by torben | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30683@lists.php.net to get a copy of this message | ||
what lexzeus@mifinca.com wrote about
functions should be a common technic
but i saw lots of code recently not using
this. you can write:
if (sizeof($array) && is_array($array)) {}
which is terribly wrong. if $array is
not an array you'll get a php error in the sizeof function, because it only supports arrays.
this would be right:
if (is_array($array) && sizeof($array)) {}
now php will stop processing this if
statement in is_array, if $array is not
an array, and continue executing after the if statement. in this way you'll never
get a php error.
So think about the order in which you place your function calls.