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) { 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/tFh1U
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
   18    13        INIT_FCALL                                               'uksort'
         14        SEND_REF                                                 !0
         15        SEND_VAL                                                 'cmp'
         16        DO_ICALL                                         $10     
         17      > JMPZ                                                     $10, ->20
   20    18    >   ECHO                                                     'success%0A'
         19      > JMP                                                      ->21
   24    20    >   ECHO                                                     'failure%0A'
   27    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 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFh1U
function name:  cmp
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $q
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        FETCH_R                      global              ~3      'GLOBALS'
          3        FETCH_DIM_R                                      ~4      ~3, 'arr'
          4        FETCH_DIM_R                                      ~5      ~4, !0
          5        FETCH_DIM_R                                      ~6      ~5, 'val2'
          6        FETCH_R                      global              ~7      'GLOBALS'
          7        FETCH_DIM_R                                      ~8      ~7, 'arr'
          8        FETCH_DIM_R                                      ~9      ~8, !1
          9        FETCH_DIM_R                                      ~10     ~9, 'val2'
         10        IS_SMALLER                                               ~10, ~6
         11      > JMPZ                                                     ~11, ->13
         12    > > RETURN                                                   1
   14    13    >   FETCH_R                      global              ~12     'GLOBALS'
         14        FETCH_DIM_R                                      ~13     ~12, 'arr'
         15        FETCH_DIM_R                                      ~14     ~13, !2
         16        FETCH_DIM_R                                      ~15     ~14, 'val2'
         17        FETCH_R                      global              ~16     'GLOBALS'
         18        FETCH_DIM_R                                      ~17     ~16, 'arr'
         19        FETCH_DIM_R                                      ~18     ~17, !1
         20        FETCH_DIM_R                                      ~19     ~18, 'val2'
         21        IS_SMALLER                                               ~15, ~19
         22      > JMPZ                                                     ~20, ->24
         23    > > RETURN                                                   -1
   15    24    > > RETURN                                                   0
   16    25*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.13 ms | 1400 KiB | 17 Q