note 8856 deleted from control-structures.foreach by philip

From: Date: Mon, 30 Dec 2002 17:50:49 +0000
Subject: note 8856 deleted from control-structures.foreach by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41480@lists.php.net to get a copy of this message
When the array is an associative array, each element has two indexes: an integer and a string. foreach() will generate *two* values for each element. (You get an associative array when you use mysql_fetch_array() to retrieve a record from a query result.) The problem with foreach returning 2 values froman associative array returned by mysql_fetch_array() can be solved by using mysql_fetch_row() which returns an array indexed only by integers or mysql_fetch_assoc() which returns an array indexed only by strings.

« previous php.notes (#41480) next »