# 3v4l.org

run code in 200+ php & hhvm versions
```<?php function levenshteinDistance(\$a, \$b) { echo("a = " + \$a + ",b = " + \$b); \$matrix = array(count(\$a) + 1); for (\$i=0; \$i<count(\$a)+1; \$i++) { \$matrix[\$i] = array(count(\$b) + 1); } for (\$i=0; \$i<count(\$a)+1; \$i++) { \$matrix[\$i][0] = \$i; } for (\$j=0; \$j<count(\$b)+1; \$j++) { \$matrix[0][\$j] = \$j; } for (\$i=1; \$i<count(\$a)+1; \$i++) { for (\$j=1; \$j<count(\$b)+1; \$j++) { //\$x = \$a[\$i - 1] == \$b[\$j -1] ? 0 : 1; if(\$a[\$i-1] == \$b[\$j-1]){ \$x = 0; } else{ \$x = 1; } \$matrix[\$i][\$j] = min( \$matrix[\$i - 1][\$j] + 1, \$matrix[\$i][\$j - 1] + 1, \$matrix[\$i - 1][\$j- 1] + \$x ); } } return \$matrix[count(\$a)][count(\$b)]; } echo levenshteinDistance("aaa","bbb"); ?>```
Output for 7.2.0
Warning: A non-numeric value encountered in /in/ai1p5 on line 3 Warning: A non-numeric value encountered in /in/ai1p5 on line 3 Warning: A non-numeric value encountered in /in/ai1p5 on line 3 Warning: A non-numeric value encountered in /in/ai1p5 on line 3 0 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 4 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 6 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 6 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 8 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 8 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 8 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 14 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 15 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 15 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 14 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 30 Warning: count(): Parameter must be an array or an object that implements Countable in /in/ai1p5 on line 30 1
Output for 7.1.0 - 7.1.7
Warning: A non-numeric value encountered in /in/ai1p5 on line 3 Warning: A non-numeric value encountered in /in/ai1p5 on line 3 Warning: A non-numeric value encountered in /in/ai1p5 on line 3 Warning: A non-numeric value encountered in /in/ai1p5 on line 3 01
Output for 4.3.0 - 7.0.20
01