2
Guys, in need of help, I have a function that returns the following array:
Array (
[0] => Array (
[0] => valor1
[2] => valor2
)
[1] => Array (
[0] => valor3
[1] => valor4
[3] => valor5
)
)
And I need to turn into that:
Array (
[0] => Array (
[0] => valor1
[1] => valor2
)
[1] => Array (
[0] => valor3
[1] => valor4
[2] => valor5
)
)
I saw in stack NA that a guy solved the problem using this function:
var_dump(
array_map(
create_function('$x','$k = key($x);
return (is_numeric($k)) ? array_values($x) : $x;'
),$aDiff
)
);
Only I didn’t quite understand where to replace the values...
Any help will be welcome!
Always remember to leave your code indented. For this, I use "4 spaces" or click the button
{ }
and then after that indent the remainder.– Patrick Maciel
The code problem posted and now revised goes beyond mere indentation. What was posted was the output of a print_r() instead of a var_export() that would have produced workable code. Not that it was hard to convert to test, of course.
– Bruno Augusto