I have the following array:
Array
(
[Places] => Array
(
[public] => 0
[entities] => Array
(
...
)
)
[Issues] => Array
(
[public] => 1
[entities] => Array
(
...
)
)
[Source] => Array
(
[public] => 0
[entities] => Array
(
...
)
)
)
I would like to be able to sort by the array by the public key. I know I may have to use either ksort or usort but I am unsure on how to implement this.
Any ideas would be great thanks!
usort($array, function ($a, $b) { return $a["public"] - $b["public"]; });
Here's an interesting link: http://www.the-art-of-web.com/php/sortarray/
I would try a
usort(usort(array, function), function);
I can try a sample code upon request, but the information is already there for the taking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With