3v4l.org

run code in 300+ PHP versions simultaneously
<?php $suggestedMunicipalities = [ 'Bělá nad Radbuzou', 'Bělá nad Svitavou', ]; $query = 'Bělá nad'; usort($suggestedMunicipalities, function (array $a, array $b) use ($query) { $aDistance = levenshtein($query, $a, 1, 1000, 1000); $bDistance = levenshtein($query, $b, 1, 1000, 1000); return $aDistance - $bDistance; }); var_dump($suggestedMunicipalities);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($a) must be of type array, string given in /in/Hv6uR:9 Stack trace: #0 [internal function]: {closure}('B\xC4\x9Bl\xC3\xA1 nad Radb...', 'B\xC4\x9Bl\xC3\xA1 nad Svit...') #1 /in/Hv6uR(9): usort(Array, Object(Closure)) #2 {main} thrown in /in/Hv6uR on line 9
Process exited with code 255.

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:
54.36 ms | 401 KiB | 8 Q