note 52662 deleted from function.is-null by danbrown

From: Date: Mon, 15 Jun 2009 12:20:56 +0000
Subject: note 52662 deleted from function.is-null by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156879@lists.php.net to get a copy of this message
Note Submitter: disappear at dissolution dot ath dot cx ---- 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 ]

« previous php.notes (#156879) next »