note 69269 added to function.array-values
| From: | wellandpowerathotmail dot com at osu1 dot php dot net | Date: | Tue, 29 Aug 2006 12:56:08 +0000 |
| Subject: | note 69269 added to function.array-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116469@lists.php.net to get a copy of this message | ||
The function here flatterns an entire array and was not the behaviour I expected from a function of
this name.
I expected the function to flattern every sub array so that all the values were aligned and it would
return an array with the same dimensions as the imput array, but as per array_values() adjusting the
keys rater than removing them.
In order to do this, you will want this function:
function array_values_recursive($array) {
$temp = array();
foreach ($array as $value) {
if(is_array($value)) { $temp[] = array_values_recursive($value); }
else { $temp[] = $value; }
}
return $temp;
}
Hopefully this will assist.
----
Server IP: 83.138.144.80
Probable Submitter: 217.41.23.195
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.array-values.php
Edit -- https://master.php.net/note/edit/69269
Del: integrated -- https://master.php.net/note/delete/69269/integrated
Del: useless -- https://master.php.net/note/delete/69269/useless
Del: bad code -- https://master.php.net/note/delete/69269/bad+code
Del: spam -- https://master.php.net/note/delete/69269/spam
Del: non-english -- https://master.php.net/note/delete/69269/non-english
Del: in docs -- https://master.php.net/note/delete/69269/in+docs
Del: other reasons-- https://master.php.net/note/delete/69269
Reject -- https://master.php.net/note/reject/69269
Search -- https://master.php.net/manage/user-notes.php