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);*/
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VKp17
function name:  (null)
number of ops:  14
compiled vars:  !0 = $myarray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '+'
          2        SEND_VAL                                                 'this+is+a+bunch+of+words'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
    4     5        INIT_FCALL                                               'usort'
          6        SEND_REF                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVKp17%3A4%240'
    7     8        SEND_VAL                                                 ~3
          9        DO_ICALL                                                 
    8    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   42    13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FVKp17%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VKp17
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        STRLEN                                           ~2      !1
          3        STRLEN                                           ~3      !0
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
    7     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVKp17%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.23 ms | 1395 KiB | 19 Q