3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['bananna', 'cranberry', 'apple']; $fn = function ($a, $b) { if(strlen($a) > strlen($b)) { return 1; } return 0; }; usort($array, $fn); var_dump( $array);

preferences:
42.86 ms | 405 KiB | 5 Q