Tuesday, 15 January 2013

PHP reverse the order of sub array -



PHP reverse the order of sub array -

here array illustration have.

array ( [0] => array ( [0] => [1] => b [2] => c ) )

i need order of sub array reversed. know function need utilize "reverse_array" not know how apply array within array.

the function need utilize array_reverse(), i'm assuming that's 1 talking about. reply question, specify array item instead of main array:

$array[0] = array_reverse($array[0]); // ^ ^

if instead wish reverse sub-arrays in array, can utilize array_map():

$array = array_map('array_reverse', $array);

php arrays

No comments:

Post a Comment