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 -1; } if ($b[0] & IS_ARRAY === IS_ARRAY) { return 1; } if ($a[0] & OPTIONAL === OPTIONAL) { return -1; } if ($b[0] & OPTIONAL === OPTIONAL) { return 1; } return 0; } ); var_dump($args);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b3XjS
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%2Fb3XjS%3A16%240'
   32    19        SEND_VAL                                                 ~11
         20        DO_ICALL                                                 
   35    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fb3XjS%3A16%240:
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 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b3XjS
function name:  {closure}
number of ops:  32
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, ->9
   18     8    > > RETURN                                                   -1
   20     9    >   FETCH_DIM_R                                      ~7      !1, 0
         10        FETCH_CONSTANT                                   ~8      'IS_ARRAY'
         11        FETCH_CONSTANT                                   ~9      'IS_ARRAY'
         12        IS_IDENTICAL                                     ~10     ~8, ~9
         13        BW_AND                                           ~11     ~7, ~10
         14      > JMPZ                                                     ~11, ->16
   21    15    > > RETURN                                                   1
   24    16    >   FETCH_DIM_R                                      ~12     !0, 0
         17        FETCH_CONSTANT                                   ~13     'OPTIONAL'
         18        FETCH_CONSTANT                                   ~14     'OPTIONAL'
         19        IS_IDENTICAL                                     ~15     ~13, ~14
         20        BW_AND                                           ~16     ~12, ~15
         21      > JMPZ                                                     ~16, ->23
   25    22    > > RETURN                                                   -1
   27    23    >   FETCH_DIM_R                                      ~17     !1, 0
         24        FETCH_CONSTANT                                   ~18     'OPTIONAL'
         25        FETCH_CONSTANT                                   ~19     'OPTIONAL'
         26        IS_IDENTICAL                                     ~20     ~18, ~19
         27        BW_AND                                           ~21     ~17, ~20
         28      > JMPZ                                                     ~21, ->30
   28    29    > > RETURN                                                   1
   31    30    > > RETURN                                                   0
   32    31*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.27 ms | 1400 KiB | 17 Q