note 52662 added to function.is-null

From: Date: Mon, 09 May 2005 03:51:05 +0000
Subject: note 52662 added to function.is-null
Groups: php.notes 
Request: Send a blank email to php-notes+get-89143@lists.php.net to get a copy of this message
i wrote a small case study to compare is_null / == NULL / === NULL Here's the code :: <?php $Array = array ( 0 , '' , FALSE , NULL ) ; $ArrayCount = count ( $Array ) ; $String .= '$Array = ' . "array ( 0 , '' , FALSE , NULL ) <br><br>" ; for ( $i = 0 ; $i < $ArrayCount ; $i++ ) { if ( $Array [ $i ] == NULL ) { $String .= '$Array [ $i ] == NULL :: $Array [ ' . $i . ' ] <br>' ; } if ( $Array [ $i ] === NULL ) { $String .= '$Array [ $i ] === NULL :: $Array [ ' . $i . ' ] <br>' ; } if ( is_null ( $Array [ $i ] ) ) { $String .= 'is_null ( $Array [ $i ] ) :: $Array [ ' . $i . ' ] <br>' ; } } echo $String ; ?> Here's the results i got :: $Array = array ( 0 , '' , FALSE , NULL ) $Array [ $i ] == NULL :: $Array [ 0 ] $Array [ $i ] == NULL :: $Array [ 1 ] $Array [ $i ] == NULL :: $Array [ 2 ] $Array [ $i ] == NULL :: $Array [ 3 ] $Array [ $i ] === NULL :: $Array [ 3 ] is_null ( $Array [ $i ] ) :: $Array [ 3 ] ---- Manual Page -- http://www.php.net/manual/en/function.is-null.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52662 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52662&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52662&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52662&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52662&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52662&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52662&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89143) next »