3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $cha1 = array(0,1,2,3,4,5); $cha2 = array(4,6,2,8,3,1); $cha1_count = count($cha1); $cha2_count = count($cha2); $cha12_count = 0; $Ck_cha2 = $cha2; for($count1 = 0; $count1 < $cha1_count; $count1++){ for($count2 = 0; $count2 < $cha2_count; $count2++){ if($cha1[$count1] == $Ck_cha2[$count2]){ $Ck_cha2[$count2] = 'Ckeck'; $cha12_count++; break; } } } echo $cha12_count; ?>
based on Y6Bub
Output for 4.3.0 - 7.1.0
4