I have array I'm checking if my variable has a value in that array. Also, get the same value as well. I need to add condition first, like for example if the variable 25 has a same value in my array $arr return true and display the array value array(2=>25)
$variable = 25;
$arr = array(1=>26, 2=>25 ,3 => 30 ,4 => 31, 5 => 32);
if(in_array($variable , $arr)){
//get the array value that have in array and display that array and preserve the key
//print_r($arr) -> 25
}