Taking the following;
// Looping through images passed to function...
list($width[$i], $height[$i]) = getimagesize($img_urls[$i]);
// ... Now to reorder by height
How can I reorder the $height
array to tallest > shortest, while maintaining the key relationship with the correct $width
value?
I've attempted with uasort
, but I've had no luck. The "closest" attempt I've had is below, but that sorts from smallest to largest
uasort($height, function($a, $b) use ($i) {
return $a[$i] + $b[$i];
});