Skip to content

Instantly share code, notes, and snippets.

@di7spider
Last active October 9, 2015 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save di7spider/21d2f836bc184427c9c7 to your computer and use it in GitHub Desktop.
Save di7spider/21d2f836bc184427c9c7 to your computer and use it in GitHub Desktop.
[PHP] array_values_recursive по ключу
<?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