I have an array that I am using to display form dropdown options. I would like to be able to display the key of a specified array element.
$options = array(
'10' => '10 Results',
'15' => '15 Results',
'20' => '20 Results',
'25' => '25 Results',
'30' => '30 Results'
);
If I use
$selected = '25';
echo $options[$selected]
this of course returns "25 Results". How would I return the key of that element?
key($options)
The above would just return the key of the first element of the array.
$selectedthe key?