3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subj = "hello world"; $subj = explode(" ", "hello world"); $str = ["hallo", "helo","aaahelojjjj", "pizza", "Manhattan"]; $minStr = ""; $minDis = PHP_INT_MAX; foreach ($str as $curStr) { Foreach($subj as $word){ $dis = levenshtein($word, $curStr); $dist[$word][$dis][] = $curStr; } } Var_export($dist);

preferences:
40.08 ms | 406 KiB | 5 Q