Using print_r returns the following array:
Array ( [5358] => red [1] => green [503] => blue )
How can I access the smallest numbered element in the array, in this case “green”?
The values will change but I just need the smallest valued element.
Using echo min($myArray); will return “red”. There must be something I’m missing here. Using usort or other “advanced” ways to first sort and then extract the largest value can’t be the only solution here… right!?!
Thanks.
min()looks in values, not in keys. array_keys() will do the trickwill do the trick. To get its value, try