note 32964 added to function.reset

From: Date: Thu, 12 Jun 2003 05:29:42 +0000
Subject: note 32964 added to function.reset
Groups: php.notes 
Request: Send a blank email to php-notes+get-50217@lists.php.net to get a copy of this message
Be aware that if you give an empty array to reset(), what you'll get back is a boolean. consider... $myarray = array(); $ret = reset($myarray); echo 'reset has type '. gettype($ret) .' and val * '. $ret; if( $ret ) { echo '*. But it evaluates true'; } else { echo '*. It evaluates false'; } if( is_null($ret) ) { echo ', and appears null'; } { echo ', and appears not null'; } echo '.'; <output> reset has type boolean and val * *. It evaluates false, and appears not null. </output> <bleaugh/> ---- Manual Page -- http://www.php.net/manual/en/function.reset.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32964 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32964&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32964&report=yes

« previous php.notes (#50217) next »