note 2475 deleted from function.each by felipe

From: Date: Sat, 29 Dec 2007 16:09:09 +0000
Subject: note 2475 deleted from function.each by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134123@lists.php.net to get a copy of this message
Note Submitter: php-traversing-matrices at mark dot datasys dot net ---- Traversing multidimensional arrays is easy, especially if you know how many dimensions are involved. Suppose you have a structure returned from a database query, such as $returned_rows[$row_number][$field_name] To walk through each field, you might try this: while ( list($row_number, $row_array) = each($query_result_array) ) { while ( list($field_name, $field_value) = each($row_array) ) { ## ## $row_number has the ## current row number, ## $field_name hsa the current ## field' name, ## $field_value has the current ## field's value } } }

« previous php.notes (#134123) next »