3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*function sortByLength($a,$b){ return strlen($b)-strlen($a); } $array = array("bbbbb", "dog", "cat", "aaa", "aaaa"); echo usort($array,'sortByLength'); // print_r($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/AFAYE
function name:  (null)
number of ops:  11
compiled vars:  !0 = $priorities
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAFAYE%3A15%240'
   31     4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   33     6        ECHO                                                     'Sorted+priorities%3A%0A'
   34     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAFAYE%3A15%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AFAYE
function name:  {closure}
number of ops:  30
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        IS_EQUAL                                                 !0, !1
          3      > JMPZ                                                     ~2, ->12
   19     4    >   ROPE_INIT                                     5  ~4      'a+%28'
          5        ROPE_ADD                                      1  ~4      ~4, !0
          6        ROPE_ADD                                      2  ~4      ~4, '%29+is+same+priority+as+b+%28'
          7        ROPE_ADD                                      3  ~4      ~4, !1
          8        ROPE_END                                      4  ~3      ~4, '%29%2C+keeping+the+same%0A'
          9        ECHO                                                     ~3
   20    10      > RETURN                                                   0
         11*       JMP                                                      ->29
   22    12    >   IS_SMALLER                                               !1, !0
         13      > JMPZ                                                     ~7, ->22
   24    14    >   ROPE_INIT                                     5  ~9      'a+%28'
         15        ROPE_ADD                                      1  ~9      ~9, !0
         16        ROPE_ADD                                      2  ~9      ~9, '%29+is+higher+priority+than+b+%28'
         17        ROPE_ADD                                      3  ~9      ~9, !1
         18        ROPE_END                                      4  ~8      ~9, '%29%2C+moving+b+down+array%0A'
         19        ECHO                                                     ~8
   25    20      > RETURN                                                   -1
         21*       JMP                                                      ->29
   28    22    >   ROPE_INIT                                     5  ~13     'b+%28'
         23        ROPE_ADD                                      1  ~13     ~13, !1
         24        ROPE_ADD                                      2  ~13     ~13, '%29+is+higher+priority+than+a+%28'
         25        ROPE_ADD                                      3  ~13     ~13, !0
         26        ROPE_END                                      4  ~12     ~13, '%29%2C+moving+b+up+array%0A'
         27        ECHO                                                     ~12
   29    28      > RETURN                                                   1
   31    29*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAFAYE%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.39 ms | 1400 KiB | 17 Q