Forum Moderators: coopster
Array
(
[userID] => 1
[userAddress] => "street"
[userPostal] => "12345"
[userCity] => "NY"
[userCountry] => "US"
[payment] => Array
(
[type] => "mastercard"
[number] => "12345678"
[cart] => Array
(
[0] => Array
(
[ID] => 1
[amount] => 31231
[comment] => ""
)
[1] => Array
(
[ID] => 13
[score] => 15611
[comment] => ""
)
[2] => Array
(
[ID] => 15
[score] => 9151
[comment] => ""
)
)
)
I need to check all of those. I've looked at array_walk_recursive and array_walk but have no idea how to use those with a multidimensional array.
Thanks in advance,
Stefan
function multiDimensionalArrayMap($func,$arr) {
$newArr = array();
if (!empty($arr)) {
foreach($arr AS $key => $value) {
$newArr[$key] = (is_array($value) ? multiDimensionalArrayMap($func,$value) : $func($value));
}
}
return $newArr;
}
$_POST = multiDimensionalArrayMap('yourFunctionHere',$_POST);
dc