Answers for "check if all values array same php"

PHP
0

check if all values in array are equal php

if(count(array_unique($array)) === 1) {
    // all values in $array are the same
} else {
    // at least 1 value in $array is different
}
Posted by: Guest on July-08-2020
0

php knoww if array has duplicate values

if (count($array) === count(array_unique($array))) {
		//values are unique
}
Posted by: Guest on December-17-2021

Code answers related to "check if all values array same php"

Browse Popular Code Answers by Language