// Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
function containsDuplicate($nums) {
    $nums = array_count_values($nums);
    foreach ($nums as $key => $num) {
	if ($num >= 2) {
	    return true;
	}
    }
    return false;
}
echo containsDuplicate([1, 2, 3, 1]);
by Luka Khitaridze
2 years ago
PHP
Array
0
Pro tip: use ```triple backticks around text``` to write in code fences