<?php class Solution { public function containsDuplicate($nums) { $hashTable = array(); foreach ($nums as $num) { if (!array_key_exists($num,$hashTable)) { $hashTable[$num] = 1; } else { return false; } } return true; } } $solution = new Solution(); echo $solution->containsDuplicate(array(2,1,3,4,5,6,7,9)); ?>