I have an array like this fetched from a database:
[0] => Array (
[permission_id] => 1
)
[1] => Array (
[permission_id] => 2
)
I would like to check if this array contains multiple values with a function. For example:
function checkIfArrayContains($array)
{
...
}
$array = array(1, 2);
checkIfArrayContains($array); //Should return true
$array = array(2);
checkIfArrayContains($array); //Should return true
$array = array(1, 2, 3);
checkIfArrayContains($array); //Should return false
How could this be achieved using PHP?
falseif you're testing an array that has a value not present in the first one?