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// All values are equal
2if (count(array_unique($allvalues)) === 1 && end($allvalues) === 'true') {
3
4}
5
6// Check the thing you don't want
7if (in_array('false', $allvalues, true)) {
8
9}
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}