3v4l.org

run code in 300+ PHP versions simultaneously
<?php const READ = 1; const WRITE = 2; function test($mask) { if ($mask & READ) { echo 'Read!' . PHP_EOL; return; } if ($mask & WRITE) { echo 'Write!' . PHP_EOL; return; } echo 'Failure!' . PHP_EOL; } test(0); test(READ); test(WRITE); test(READ | WRITE);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n57N9
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'READ', 1
    4     1        DECLARE_CONST                                            'WRITE', 2
   21     2        INIT_FCALL                                               'test'
          3        SEND_VAL                                                 0
          4        DO_FCALL                                      0          
   22     5        INIT_FCALL                                               'test'
          6        FETCH_CONSTANT                                   ~1      'READ'
          7        SEND_VAL                                                 ~1
          8        DO_FCALL                                      0          
   23     9        INIT_FCALL                                               'test'
         10        FETCH_CONSTANT                                   ~3      'WRITE'
         11        SEND_VAL                                                 ~3
         12        DO_FCALL                                      0          
   24    13        INIT_FCALL                                               'test'
         14        FETCH_CONSTANT                                   ~5      'READ'
         15        FETCH_CONSTANT                                   ~6      'WRITE'
         16        BW_OR                                            ~7      ~5, ~6
         17        SEND_VAL                                                 ~7
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n57N9
function name:  test
number of ops:  13
compiled vars:  !0 = $mask
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        FETCH_CONSTANT                                   ~1      'READ'
          2        BW_AND                                           ~2      !0, ~1
          3      > JMPZ                                                     ~2, ->6
    9     4    >   ECHO                                                     'Read%21%0A'
   10     5      > RETURN                                                   null
   13     6    >   FETCH_CONSTANT                                   ~3      'WRITE'
          7        BW_AND                                           ~4      !0, ~3
          8      > JMPZ                                                     ~4, ->11
   14     9    >   ECHO                                                     'Write%21%0A'
   15    10      > RETURN                                                   null
   18    11    >   ECHO                                                     'Failure%21%0A'
   19    12      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.34 ms | 1390 KiB | 17 Q