3v4l.org

run code in 300+ PHP versions simultaneously
<?php const READ = 1; const WRITE = 2; const READ_WRITE = 3; function test($mask) { if ($mask & READ_WRITE) { echo 'Read/Write!' . PHP_EOL; return; } 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/NYAEK
function name:  (null)
number of ops:  21
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
    5     2        DECLARE_CONST                                            'READ_WRITE', 3
   27     3        INIT_FCALL                                               'test'
          4        SEND_VAL                                                 0
          5        DO_FCALL                                      0          
   28     6        INIT_FCALL                                               'test'
          7        FETCH_CONSTANT                                   ~1      'READ'
          8        SEND_VAL                                                 ~1
          9        DO_FCALL                                      0          
   29    10        INIT_FCALL                                               'test'
         11        FETCH_CONSTANT                                   ~3      'WRITE'
         12        SEND_VAL                                                 ~3
         13        DO_FCALL                                      0          
   30    14        INIT_FCALL                                               'test'
         15        FETCH_CONSTANT                                   ~5      'READ'
         16        FETCH_CONSTANT                                   ~6      'WRITE'
         17        BW_OR                                            ~7      ~5, ~6
         18        SEND_VAL                                                 ~7
         19        DO_FCALL                                      0          
         20      > 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
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NYAEK
function name:  test
number of ops:  18
compiled vars:  !0 = $mask
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        FETCH_CONSTANT                                   ~1      'READ_WRITE'
          2        BW_AND                                           ~2      !0, ~1
          3      > JMPZ                                                     ~2, ->6
   10     4    >   ECHO                                                     'Read%2FWrite%21%0A'
   11     5      > RETURN                                                   null
   14     6    >   FETCH_CONSTANT                                   ~3      'READ'
          7        BW_AND                                           ~4      !0, ~3
          8      > JMPZ                                                     ~4, ->11
   15     9    >   ECHO                                                     'Read%21%0A'
   16    10      > RETURN                                                   null
   19    11    >   FETCH_CONSTANT                                   ~5      'WRITE'
         12        BW_AND                                           ~6      !0, ~5
         13      > JMPZ                                                     ~6, ->16
   20    14    >   ECHO                                                     'Write%21%0A'
   21    15      > RETURN                                                   null
   24    16    >   ECHO                                                     'Failure%21%0A'
   25    17      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.29 ms | 1403 KiB | 17 Q