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) { echo "a is array\n"; return -1; } if ($b[0] & IS_ARRAY === IS_ARRAY) { echo "b is array\n"; return 1; } if ($a[0] & OPTIONAL === OPTIONAL) { echo "a is optional\n"; return -1; } if ($b[0] & OPTIONAL === OPTIONAL) { echo "b is optional\n"; 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/W5fhu
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%2FW5fhu%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%2FW5fhu%3A16%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
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 = 26
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W5fhu
function name:  {closure}
number of ops:  36
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, ->10
          8    >   ECHO                                                     'a+is+array%0A'
   18     9      > RETURN                                                   -1
   20    10    >   FETCH_DIM_R                                      ~7      !1, 0
         11        FETCH_CONSTANT                                   ~8      'IS_ARRAY'
         12        FETCH_CONSTANT                                   ~9      'IS_ARRAY'
         13        IS_IDENTICAL                                     ~10     ~8, ~9
         14        BW_AND                                           ~11     ~7, ~10
         15      > JMPZ                                                     ~11, ->18
         16    >   ECHO                                                     'b+is+array%0A'
   21    17      > RETURN                                                   1
   24    18    >   FETCH_DIM_R                                      ~12     !0, 0
         19        FETCH_CONSTANT                                   ~13     'OPTIONAL'
         20        FETCH_CONSTANT                                   ~14     'OPTIONAL'
         21        IS_IDENTICAL                                     ~15     ~13, ~14
         22        BW_AND                                           ~16     ~12, ~15
         23      > JMPZ                                                     ~16, ->26
         24    >   ECHO                                                     'a+is+optional%0A'
   25    25      > RETURN                                                   -1
   27    26    >   FETCH_DIM_R                                      ~17     !1, 0
         27        FETCH_CONSTANT                                   ~18     'OPTIONAL'
         28        FETCH_CONSTANT                                   ~19     'OPTIONAL'
         29        IS_IDENTICAL                                     ~20     ~18, ~19
         30        BW_AND                                           ~21     ~17, ~20
         31      > JMPZ                                                     ~21, ->34
         32    >   ECHO                                                     'b+is+optional%0A'
   28    33      > RETURN                                                   1
   31    34    > > RETURN                                                   0
   32    35*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.99 ms | 1405 KiB | 17 Q