3v4l.org

run code in 300+ PHP versions simultaneously
<?php function edit_distance_ond($str1 ,$str2){ $array = array(); $x; $y; $offset = count($str1); $array[$offset + 1] = 0; for($D = 0; $D <= count($str1) + count($str2); $D++){ for($k = -$D; $k <= $D; k += 2){ if($k == -$D || $k != $D && $array[$k-1+$offset] < $array[$k+1+$offset]) $x = $array[$k+1+$offset]; else $x = $array[$k-1+$offset] + 1; $y = $x - $k; while($x < count($str1) && $y < count($str2) && $str1[$x] == $str2[$y]){ $x++; $y++; } $array[$k+$offset] = $x; if($x >= count($str1) && $y >= count($str2)) return $D; } } return -1; } $a = "test"; $b = "ttst2"; $edo = edit_distance_ond($a,$b); echo $edo; ?>
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '+=' (T_PLUS_EQUAL), expecting ')' in /in/d7j3W on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PLUS_EQUAL, expecting ')' in /in/d7j3W on line 9
Process exited with code 255.

preferences:
182.95 ms | 1386 KiB | 65 Q