1
I’m trying to check if any value exists in an array in 1 array I can check if there is more when the array has another array inside I can’t verify if it exists.
1 array
$array = array("Volvo" => 'BMW', "BMW" => 'X5');
array (size=2)
'Volvo' => string 'XC90' (length=4)
'BMW' => string 'X5' (length=2)
result of 1 array
if (array_key_exists("Volvo",$array):
echo "existe!";
else :
echo "não existe!";
endif;
// resultado "existe"
2 array
$array = array(array('volvo' => 'XC90'), array('BMW' => 'X5'));
0 =>
array (size=1)
volvo' => string 'XC90' (length=4)
1 =>
array (size=1)
'BMW' => string 'X5' (length=4)
result of 2 array
if (array_key_exists("Volvo",$array):
echo "existe!";
else :
echo "não existe!";
endif;
// resultado "não existe"
thanks for the reply I managed to resolve.
– diogo Dsa