3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = range('A', 'I'); $array2 = array( 8 => 'I'); $size1 = count($array1); $size2 = count($array2); $hit = 0; $miss = -1; $max_size = max($size1, $size2); $array3 = array(); for($i = 0; $i < $max_size; $i++) { $flag = 0; if(isset($array1[$i]) && isset($array2[$i])) { if($array1[$i] === $array2[$i]) { $hit++; $miss = -1; } else $flag = 1; } else { $flag = 1; } if($flag == 1) { if($miss == -1) { if($hit > 0) array_push($array3, $hit); $miss = 0; array_push($array3, 0); } $hit = 0; } } if($hit > 0) array_push($array3, $hit); print_r($array3);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 0 [1] => 1 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.97 ms | 401 KiB | 8 Q