Hello Reader's If you have an multidimensional array which you want to sort. Then PHP offers you many ways to do it.
Let's see the easiest way to achieve it:-
Array
(
[0] => Array
(
[0] => dave
[1] => jones
[2] => c@b.c
)
[1] => Array
(
[0] => john
[1] => jones
[2] => a@b.c
)
[2] => Array
(
[0] => bruce
[1] => finkle
[2] => c@b.c
)
)
Now make the logic as below:-
$newArr = array();
foreach ($array as $val) {
$newArr[$val[2]] = $val;
}
$array = array_values($newArr);
0 Comment(s)