3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(); $arr['i1']['val1'] = 99; $arr['i1']['val2'] = 100; $arr['i2']['val1'] = 89; $arr['i2']['val2'] = 101; function cmp($a, $b) { static $called = 0; echo $called++, "\n"; if ($called > 10) return 0; if ($GLOBALS['arr'][$a]['val2'] > $GLOBALS['arr'][$b]['val2']) { return 1; } if ($GLOBALS['arr'][$q]['val2'] < $GLOBALS['arr'][$b]['val2']) { return -1; } return 0; } if (uksort($arr, 'cmp')) { echo "success\n"; } else { echo "failure\n"; } print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4F1Xn
function name:  (null)
number of ops:  25
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        FETCH_DIM_W                                      $2      !0, 'i1'
          2        ASSIGN_DIM                                               $2, 'val1'
          3        OP_DATA                                                  99
    5     4        FETCH_DIM_W                                      $4      !0, 'i1'
          5        ASSIGN_DIM                                               $4, 'val2'
          6        OP_DATA                                                  100
    7     7        FETCH_DIM_W                                      $6      !0, 'i2'
          8        ASSIGN_DIM                                               $6, 'val1'
          9        OP_DATA                                                  89
    8    10        FETCH_DIM_W                                      $8      !0, 'i2'
         11        ASSIGN_DIM                                               $8, 'val2'
         12        OP_DATA                                                  101
   21    13        INIT_FCALL                                               'uksort'
         14        SEND_REF                                                 !0
         15        SEND_VAL                                                 'cmp'
         16        DO_ICALL                                         $10     
         17      > JMPZ                                                     $10, ->20
   23    18    >   ECHO                                                     'success%0A'
         19      > JMP                                                      ->21
   27    20    >   ECHO                                                     'failure%0A'
   30    21    >   INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function cmp:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4F1Xn
function name:  cmp
number of ops:  33
compiled vars:  !0 = $a, !1 = $b, !2 = $called, !3 = $q
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        BIND_STATIC                                              !2
   14     3        POST_INC                                         ~4      !2
          4        ECHO                                                     ~4
          5        ECHO                                                     '%0A'
   15     6        IS_SMALLER                                               10, !2
          7      > JMPZ                                                     ~5, ->9
          8    > > RETURN                                                   0
   16     9    >   FETCH_R                      global              ~6      'GLOBALS'
         10        FETCH_DIM_R                                      ~7      ~6, 'arr'
         11        FETCH_DIM_R                                      ~8      ~7, !0
         12        FETCH_DIM_R                                      ~9      ~8, 'val2'
         13        FETCH_R                      global              ~10     'GLOBALS'
         14        FETCH_DIM_R                                      ~11     ~10, 'arr'
         15        FETCH_DIM_R                                      ~12     ~11, !1
         16        FETCH_DIM_R                                      ~13     ~12, 'val2'
         17        IS_SMALLER                                               ~13, ~9
         18      > JMPZ                                                     ~14, ->20
         19    > > RETURN                                                   1
   17    20    >   FETCH_R                      global              ~15     'GLOBALS'
         21        FETCH_DIM_R                                      ~16     ~15, 'arr'
         22        FETCH_DIM_R                                      ~17     ~16, !3
         23        FETCH_DIM_R                                      ~18     ~17, 'val2'
         24        FETCH_R                      global              ~19     'GLOBALS'
         25        FETCH_DIM_R                                      ~20     ~19, 'arr'
         26        FETCH_DIM_R                                      ~21     ~20, !1
         27        FETCH_DIM_R                                      ~22     ~21, 'val2'
         28        IS_SMALLER                                               ~18, ~22
         29      > JMPZ                                                     ~23, ->31
         30    > > RETURN                                                   -1
   18    31    > > RETURN                                                   0
   19    32*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.08 ms | 1400 KiB | 17 Q