Below is my array :
$my_value_is = Array ( [2] => Array ( [id] => 2 [price] => 23) [50] => Array ( [id] => 50 [price] => 56 ) )
$my_var = 56;
I need it to return true if all columns ( price ) match that given variable value; otherwise, it should return false.
hence as per my $my_var, i should get result as false, because id:2 has price:23 which is not matching.
I tried in_array function, but that wont work :
$u_in_array = in_array($my_var, array_column($my_value_is , 'price'));
if($u_in_array ) {
echo 'value is true';
} else {
echo 'value is false';
}
but it giving me as value is true , where as i need value is false.