Vérifiez si toutes les valeurs du tableau sont égales PHP
if(count(array_unique($array)) === 1) {
// all values in $array are the same
} else {
// at least 1 value in $array is different
}
if(count(array_unique($array)) === 1) {
// all values in $array are the same
} else {
// at least 1 value in $array is different
}
// 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)) {
}
$allvalues = array('true', 'true', 'true');
if (count(array_unique($allvalues)) === 1 && end($allvalues) === 'true') {
}
if(count(array_unique($array, SORT_REGULAR)) < count($array)) {
// $array has duplicates
} else {
// $array does not have duplicates
}