check if any values are the same in an array php

PHP
if(count(array_unique($array, SORT_REGULAR)) < count($array)) {
    // $array has duplicates
} else {
    // $array does not have duplicates
}
Source

Also in PHP: