I have an existing array in PHP like so (when i use print_r
):
Array (
[0] => Array(
[value] => 188
[label] => Lucy
)
[1] => Array (
[value] => 189
[label] => Jessica
)
[2] => Array (
[value] => 192
[label] => Lisa
)
[3] => Array (
[value] => 167
[label] => Carol
)
// and so on...
)
From this array i need to manipulate or create a new array like so:
Array (
[Lucy] => 188
[Jessica] => 189
[Lisa] => 192
[Carol] => 167
)
What's the best way of doing so?
I need the names to become the keys so i can then sort alphabetically like so:
uksort($array, 'strnatcasecmp');