Array
(
[playerstats] => Array
(
[stats] => Array
(
[0] => Array
(
[name] => total_kills
[value] => 51652
)
[1] => Array
(
[name] => total_deaths
[value] => 42005
)
[2] => Array
(
[name] => total_time_played
[value] => 3786773
)
[3] => Array
(
[name] => total_planted_bombs
[value] => 1673
)
[4] => Array
(
[name] => total_defused_bombs
[value] => 405
)
И так далее...
function search_name($item, $value)
{
//print_r(array($item, $value));
if (is_array($item) && !empty($item['name']) && $item['name'] == $value) {
return $item['value'];
}
}
function array_search_recursive($arr, $value)
{
if (search_name($arr, $value) == false) {
foreach ($arr as $item) {
//print_r($item);
array_search_recursive($item, $value);
}
} else {
echo search_name($arr, $value);
}
}
array_search_recursive($array, 'total_kills');