Hi I am actually trying to sort an array at third level with different keys.
The below is Sample array input.
Array
(
[19067] => Array
(
[Morrisville, PA] => 5.02
)
[18977] => Array
(
[Washington Crossing, PA] => 6.63
)
[08695] => Array
(
[Trenton, NJ] => 2.84
)
[08690] => Array
(
[Trenton, NJ] => 1
)
[08666] => Array
(
[Trenton, NJ] => 2.84
)
[08650] => Array
(
[Trenton, NJ] => 0
)
[08648] => Array
(
[Lawrence Township, NJ] => 2.88
)
[08647] => Array
(
[Trenton, NJ] => 2.84
)
[08646] => Array
(
[Trenton, NJ] => 2
)
)
Can any body help me to sort the above array at third level
Expected result should like:
Output:
Array
(
[08650] => Array
(
[Trenton, NJ] => 0
)
[08690] => Array
(
[Trenton, NJ] => 1
)
[08646] => Array
(
[Trenton, NJ] => 2
)
[08666] => Array
(
[Trenton, NJ] => 2.84
)
[08695] => Array
(
[Trenton, NJ] => 2.84
)
[08647] => Array
(
[Trenton, NJ] => 2.84
)
[08648] => Array
(
[Lawrence Township, NJ] => 2.88
)
[19067] => Array
(
[Morrisville, PA] => 5.02
)
[18977] => Array
(
[Washington Crossing, PA] => 6.63
)
)
Thanks in advance..
Do note the comments: values which differ less than 1.0 will be sorted as the same. You may want to do
(current($a) - current($b)) * 100or otherwise round the value, depending on what value ranges you expect.