1if(count(array_unique($array)) === 1) {
2 // all values in $array are the same
3} else {
4 // at least 1 value in $array is different
5}
1$allvalues = array('true', 'true', 'true');
2if (count(array_unique($allvalues)) === 1 && end($allvalues) === 'true') {
3}
11. Check if all values are equal without knowing the values from array:
2$array = array('true', 'true', 'true');
3if((count(array_unique($array)) === 1)) {
4 echo "all equal";
5} else {
6 echo "not equal";
7}
8
92. Check if all values are equal when you know the value from array:
10- In this case we know the equal value should be "true"
11$array = array('true', 'true', 'true');
12if (count(array_unique($array)) === 1 && end($array) === 'true') {
13}