note 32793 added to function.sizeof

From: Date: Fri, 06 Jun 2003 22:53:57 +0000
Subject: note 32793 added to function.sizeof
Groups: php.notes 
Request: Send a blank email to php-notes+get-49922@lists.php.net to get a copy of this message
ricardo, jcollins: the reason sizeof return 8 instead of 4 is that (from the mysql_fetch_array page): In addition to storing the data in the numeric indices of the result array, [mysql_fetch_array] also stores the data in associative indices, using the field names as keys. so you're getting an array that looks like this: array( 0 => 0, 'cp1' => 0, 1 => 0, 'cp2' => 0, 2 => 0, 'cp3' => 0, 3 => 0, 'cp4' => 0, ) four columns, eight elements. this topic is explored further on that page. ---- Manual Page -- http://www.php.net/manual/en/function.sizeof.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32793 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32793&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32793&report=yes

« previous php.notes (#49922) next »