3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array("123", "1244","34124","123"); $dupe_array = array(); foreach($array as $val){ if(++$dupe_array[$val] > 1){ echo "has duplicate"; } } echo "has no duplicate";
Output for 5.4.0 - 7.1.0
Notice: Undefined offset: 123 in /in/oOp1r on line 6 Notice: Undefined offset: 1244 in /in/oOp1r on line 6 Notice: Undefined offset: 34124 in /in/oOp1r on line 6 has duplicatehas no duplicate
Output for 5.3.0 - 5.3.29
Notice: Undefined index: 123 in /in/oOp1r on line 6 Notice: Undefined index: 1244 in /in/oOp1r on line 6 Notice: Undefined index: 34124 in /in/oOp1r on line 6 has duplicatehas no duplicate
Output for 4.3.0 - 5.2.17
Notice: Undefined index: 123 in /in/oOp1r on line 6 Notice: Undefined index: 1244 in /in/oOp1r on line 6 Notice: Undefined index: 34124 in /in/oOp1r on line 6 has duplicatehas no duplicate