3v4l.org

run code in 300+ PHP versions simultaneously
<?php const REQUIRED = 1; const OPTIONAL = 2; const IS_ARRAY = 4; $args = [ 'a' => [IS_ARRAY], 'b' => [OPTIONAL], 'c' => [REQUIRED], 'd' => [REQUIRED] ]; uasort( $args, function ($a, $b) { if ($a[0] & IS_ARRAY === IS_ARRAY) { return ($b[0] & IS_ARRAY === IS_ARRAY) ? 0 : 1; } if ($b[0] & IS_ARRAY === IS_ARRAY) { return ($a[0] & IS_ARRAY === IS_ARRAY) ? 0 : -1; } if ($a[0] & OPTIONAL === OPTIONAL) { if ($b[0] & IS_ARRAY === IS_ARRAY) { return 1; } return ($b[0] & OPTIONAL === OPTIONAL) ? 0 : -1; } if ($b[0] & OPTIONAL === OPTIONAL) { if ($a[0] & IS_ARRAY === IS_ARRAY) { return -1; } return ($a[0] & OPTIONAL === OPTIONAL) ? 0 : 1; } return 0; } ); var_dump($args);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gpH5f
function name:  (null)
number of ops:  25
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'REQUIRED', 1
    4     1        DECLARE_CONST                                            'OPTIONAL', 2
    5     2        DECLARE_CONST                                            'IS_ARRAY', 4
    8     3        FETCH_CONSTANT                                   ~1      'IS_ARRAY'
          4        INIT_ARRAY                                       ~2      ~1
          5        INIT_ARRAY                                       ~3      ~2, 'a'
    9     6        FETCH_CONSTANT                                   ~4      'OPTIONAL'
          7        INIT_ARRAY                                       ~5      ~4
          8        ADD_ARRAY_ELEMENT                                ~3      ~5, 'b'
   10     9        FETCH_CONSTANT                                   ~6      'REQUIRED'
         10        INIT_ARRAY                                       ~7      ~6
         11        ADD_ARRAY_ELEMENT                                ~3      ~7, 'c'
   11    12        FETCH_CONSTANT                                   ~8      'REQUIRED'
         13        INIT_ARRAY                                       ~9      ~8
         14        ADD_ARRAY_ELEMENT                                ~3      ~9, 'd'
    7    15        ASSIGN                                                   !0, ~3
   14    16        INIT_FCALL                                               'uasort'
   15    17        SEND_REF                                                 !0
   16    18        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgpH5f%3A16%240'
   38    19        SEND_VAL                                                 ~11
         20        DO_ICALL                                                 
   41    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FgpH5f%3A16%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 34
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 57
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 47
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 80
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 70
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 78
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 79
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gpH5f
function name:  {closure}
number of ops:  82
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        FETCH_DIM_R                                      ~2      !0, 0
          3        FETCH_CONSTANT                                   ~3      'IS_ARRAY'
          4        FETCH_CONSTANT                                   ~4      'IS_ARRAY'
          5        IS_IDENTICAL                                     ~5      ~3, ~4
          6        BW_AND                                           ~6      ~2, ~5
          7      > JMPZ                                                     ~6, ->18
   18     8    >   FETCH_DIM_R                                      ~7      !1, 0
          9        FETCH_CONSTANT                                   ~8      'IS_ARRAY'
         10        FETCH_CONSTANT                                   ~9      'IS_ARRAY'
         11        IS_IDENTICAL                                     ~10     ~8, ~9
         12        BW_AND                                           ~11     ~7, ~10
         13      > JMPZ                                                     ~11, ->16
         14    >   QM_ASSIGN                                        ~12     0
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~12     1
         17    > > RETURN                                                   ~12
   20    18    >   FETCH_DIM_R                                      ~13     !1, 0
         19        FETCH_CONSTANT                                   ~14     'IS_ARRAY'
         20        FETCH_CONSTANT                                   ~15     'IS_ARRAY'
         21        IS_IDENTICAL                                     ~16     ~14, ~15
         22        BW_AND                                           ~17     ~13, ~16
         23      > JMPZ                                                     ~17, ->34
   21    24    >   FETCH_DIM_R                                      ~18     !0, 0
         25        FETCH_CONSTANT                                   ~19     'IS_ARRAY'
         26        FETCH_CONSTANT                                   ~20     'IS_ARRAY'
         27        IS_IDENTICAL                                     ~21     ~19, ~20
         28        BW_AND                                           ~22     ~18, ~21
         29      > JMPZ                                                     ~22, ->32
         30    >   QM_ASSIGN                                        ~23     0
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~23     -1
         33    > > RETURN                                                   ~23
   24    34    >   FETCH_DIM_R                                      ~24     !0, 0
         35        FETCH_CONSTANT                                   ~25     'OPTIONAL'
         36        FETCH_CONSTANT                                   ~26     'OPTIONAL'
         37        IS_IDENTICAL                                     ~27     ~25, ~26
         38        BW_AND                                           ~28     ~24, ~27
         39      > JMPZ                                                     ~28, ->57
   25    40    >   FETCH_DIM_R                                      ~29     !1, 0
         41        FETCH_CONSTANT                                   ~30     'IS_ARRAY'
         42        FETCH_CONSTANT                                   ~31     'IS_ARRAY'
         43        IS_IDENTICAL                                     ~32     ~30, ~31
         44        BW_AND                                           ~33     ~29, ~32
         45      > JMPZ                                                     ~33, ->47
   26    46    > > RETURN                                                   1
   28    47    >   FETCH_DIM_R                                      ~34     !1, 0
         48        FETCH_CONSTANT                                   ~35     'OPTIONAL'
         49        FETCH_CONSTANT                                   ~36     'OPTIONAL'
         50        IS_IDENTICAL                                     ~37     ~35, ~36
         51        BW_AND                                           ~38     ~34, ~37
         52      > JMPZ                                                     ~38, ->55
         53    >   QM_ASSIGN                                        ~39     0
         54      > JMP                                                      ->56
         55    >   QM_ASSIGN                                        ~39     -1
         56    > > RETURN                                                   ~39
   30    57    >   FETCH_DIM_R                                      ~40     !1, 0
         58        FETCH_CONSTANT                                   ~41     'OPTIONAL'
         59        FETCH_CONSTANT                                   ~42     'OPTIONAL'
         60        IS_IDENTICAL                                     ~43     ~41, ~42
         61        BW_AND                                           ~44     ~40, ~43
         62      > JMPZ                                                     ~44, ->80
   31    63    >   FETCH_DIM_R                                      ~45     !0, 0
         64        FETCH_CONSTANT                                   ~46     'IS_ARRAY'
         65        FETCH_CONSTANT                                   ~47     'IS_ARRAY'
         66        IS_IDENTICAL                                     ~48     ~46, ~47
         67        BW_AND                                           ~49     ~45, ~48
         68      > JMPZ                                                     ~49, ->70
   32    69    > > RETURN                                                   -1
   34    70    >   FETCH_DIM_R                                      ~50     !0, 0
         71        FETCH_CONSTANT                                   ~51     'OPTIONAL'
         72        FETCH_CONSTANT                                   ~52     'OPTIONAL'
         73        IS_IDENTICAL                                     ~53     ~51, ~52
         74        BW_AND                                           ~54     ~50, ~53
         75      > JMPZ                                                     ~54, ->78
         76    >   QM_ASSIGN                                        ~55     0
         77      > JMP                                                      ->79
         78    >   QM_ASSIGN                                        ~55     1
         79    > > RETURN                                                   ~55
   37    80    > > RETURN                                                   0
   38    81*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgpH5f%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
289.78 ms | 1404 KiB | 18 Q