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);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'hello' => array ( 1 => array ( 0 => 'hallo', 1 => 'helo', ), 8 => array ( 0 => 'aaahelojjjj', 1 => 'Manhattan', ), 5 => array ( 0 => 'pizza', ), ), 'world' => array ( 4 => array ( 0 => 'hallo', 1 => 'helo', ), 10 => array ( 0 => 'aaahelojjjj', ), 5 => array ( 0 => 'pizza', ), 9 => array ( 0 => 'Manhattan', ), ), )

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:
168.83 ms | 406 KiB | 5 Q