Searches the array for a given value and returns the first corresponding key if successful. If the third parameter strict is set to TRUE then it will search for identical elements in the array.

array:get_key_by_value(ARRAY $array, STRING $value, BOOL $strict=FALSE)

$array = ["first_name" => "Amil", "last_name" => "googooli"]
array:get_key_by_value($array, "Amil")
#=> "first_name"

#===
$array = ["googooli", "Amil", "Amil"]
array:get_key_by_value($array, "Amil", TRUE)
#=> 1

Copyright ©2013-2022 SunSed®. All rights reserved.