php reverse sort an array
If you have an array in ascending order and you require it to be in descending order you can use the array_reverse function as below.
$terms = array_reverse($terms);
If you have an array in ascending order and you require it to be in descending order you can use the array_reverse function as below.
$terms = array_reverse($terms);
The code below shows how to iterate through an array and print the keys and values held within an array.
while (list($key, $val) = each($items)) { print $key . " -> " . $val; }
To allocate within a new array simply:
while (list($key, $val) = each($items)) { $terms[] = $val . ") " . $key; }