3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $k=0; $array1=Array(1,2,3); $array2=Array(1,3,5); $array3=Array(); for($i=0;$i<count($array1);$i++) { if(!in_array($array1[$i],$array2)) { if(!in_array($array1[$i],$array3)) { $array3[$k]=$array1[$i]; $k++; } } } for($j=0;$j<count($array2);$j++) { if(!in_array($array2[$j],$array1)) { if(!in_array($array2[$j],$array3)) { $array3[$k]=$array2[$j]; $k++; } } } print_r($array3);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 2 [1] => 5 )