php check if duplicate value in two array code example
Example 1: php check if all array values are the same
// All values are equal
if (count(array_unique($allvalues)) === 1 && end($allvalues) === 'true') {
}
// Check the thing you don't want
if (in_array('false', $allvalues, true)) {
}
Example 2: php check for duplicates in array
function has_dupes($array) {
$dupe_array = array();
foreach ($array as $val) {
if (++$dupe_array[$val] > 1) {
return true;
}
}
return false;
}