I have the following variable with name $array
which has the following values
array (size=5)
0 =>
array (size=1)
'name' => string 'a' (length=7)
1 =>
array (size=1)
'name' => string 'b' (length=7)
2 =>
array (size=1)
'name' => string 'c' (length=3)
3 =>
array (size=1)
'name' => string 'd' (length=5)
4 =>
array (size=1)
'name' => string 'f' (length=6)
I have the variable named $check
which has the value 'a'
.
I want to check if the value of the $check
exists in the array of the variable $array
I have tried with in_array
, but I can only access by setting the key number in this way:
if(in_array($check, $array[0])):
echo "existe";
else:
echo "nao existe";
endif;