3v4l.org

run code in 300+ PHP versions simultaneously
<?php const READ = 1; const WRITE = 2; 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/ZkMe7
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
   26     2        INIT_FCALL                                               'test'
          3        SEND_VAL                                                 0
          4        DO_FCALL                                      0          
   27     5        INIT_FCALL                                               'test'
          6        FETCH_CONSTANT                                   ~1      'READ'
          7        SEND_VAL                                                 ~1
          8        DO_FCALL                                      0          
   28     9        INIT_FCALL                                               'test'
         10        FETCH_CONSTANT                                   ~3      'WRITE'
         11        SEND_VAL                                                 ~3
         12        DO_FCALL                                      0          
   29    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 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZkMe7
function name:  test
number of ops:  20
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        FETCH_CONSTANT                                   ~3      'WRITE'
          4        BW_AND                                           ~4      ~2, ~3
          5      > JMPZ                                                     ~4, ->8
    9     6    >   ECHO                                                     'Read%2FWrite%21%0A'
   10     7      > RETURN                                                   null
   13     8    >   FETCH_CONSTANT                                   ~5      'READ'
          9        BW_AND                                           ~6      !0, ~5
         10      > JMPZ                                                     ~6, ->13
   14    11    >   ECHO                                                     'Read%21%0A'
   15    12      > RETURN                                                   null
   18    13    >   FETCH_CONSTANT                                   ~7      'WRITE'
         14        BW_AND                                           ~8      !0, ~7
         15      > JMPZ                                                     ~8, ->18
   19    16    >   ECHO                                                     'Write%21%0A'
   20    17      > RETURN                                                   null
   23    18    >   ECHO                                                     'Failure%21%0A'
   24    19      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.12 ms | 1403 KiB | 17 Q