I have some ugly multidimensional associative arrays that I’d really rather deal with as numeric indexes… indexii ? anyway, I’ve tried array_values, but it’s not recursive. Also, I’m not interested in flattening the array at all.
Appreciate any help, thanks
Thanks, I’ll take a look at it and report back any problems.
function array_values_recursive( $array ) {
$array = array_values( $array );
for ( $i = 0, $n = count( $array ); $i < $n; $i++ ) {
$element = $array[$i];
if ( is_array( $element ) ) {
$array[$i] = array_values_recursive( $element );
}
}
return $array;
}