3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = explode(" ", "this is a bunch of words"); usort($myarray, function($a, $b) { return strlen($b) - strlen($a); }); print_r($myarray); /*function sortByLength($a,$b){ return strlen($b)-strlen($a); } $array = array("bbbbb", "dog", "cat", "aaa", "aaaa"); $sorted = usort($array,'sortByLength'); var_dump($sorted);*/ /*$priorities = array(5, 8, 3, 7, 3); usort($priorities, function($a, $b) { if ($a == $b) { echo "a ($a) is same priority as b ($b), keeping the same\n"; return 0; } else if ($a > $b) { echo "a ($a) is higher priority than b ($b), moving b down array\n"; return -1; } else { echo "b ($b) is higher priority than a ($a), moving b up array\n"; return 1; } }); echo "Sorted priorities:\n"; var_dump($priorities);*/
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => bunch [1] => words [2] => this [3] => is [4] => of [5] => a )

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