You can easily get an array value by its key like so: $value = array[$key] but what if I have the value and I want its key. What\'s the best way to get it?
$value = array[$key]
You can use the array_keys function for that.
Example:
$array = array("blue", "red", "green", "blue", "blue"); print_r(array_keys($array, "blue"));
This will get the key from the array for value blue
blue