Last active
October 9, 2015 12:01
-
-
Save di7spider/21d2f836bc184427c9c7 to your computer and use it in GitHub Desktop.
[PHP] array_values_recursive по ключу
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_values_recursive($ar, $field) | |
{ | |
if( !empty($field) && array_key_exists($field, $ar) ){ | |
$arTemp = &$ar[$field]; | |
if( is_array($arTemp) ){ | |
$arTemp = array_values($arTemp); | |
foreach($arTemp as $key => &$value){ | |
$value = array_values_recursive($value, $field); | |
} | |
} | |
} | |
return $ar; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment