3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php const READ = 1; const WRITE = 2; function test($mask) { if ($mask & READ && $mask & WRITE) { echo 'Read/Write!' . PHP_EOL; } if ($mask & WRITE) { echo 'Write!' . PHP_EOL; } } test(0); test(READ); test(WRITE); test(READ | WRITE);
based on LFO8r
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/8uK6K
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
   6     2        NOP                                                      
  18     3        INIT_FCALL                                               'test'
         4        SEND_VAL                                                 0
         5        DO_FCALL                                      0          
  19     6        INIT_FCALL                                               'test'
         7        FETCH_CONSTANT                                   ~1      'READ'
         8        SEND_VAL                                                 ~1
         9        DO_FCALL                                      0          
  20    10        INIT_FCALL                                               'test'
        11        FETCH_CONSTANT                                   ~3      'WRITE'
        12        SEND_VAL                                                 ~3
        13        DO_FCALL                                      0          
  21    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
Jump found. Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
Jump found. Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
Jump found. Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
Jump found. Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 9
Branch analysis from position: 7
filename:       /in/8uK6K
function name:  test
number of ops:  14
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_EX                                          ~2      ~2, ->7
         4    >   FETCH_CONSTANT                                   ~3      'WRITE'
         5        BW_AND                                           ~4      !0, ~3
         6        BOOL                                             ~2      ~4
         7    > > JMPZ                                                     ~2, ->9
   9     8    >   ECHO                                                     'Read%2FWrite%21%0A'
  12     9    >   FETCH_CONSTANT                                   ~5      'WRITE'
        10        BW_AND                                           ~6      !0, ~5
        11      > JMPZ                                                     ~6, ->13
  13    12    >   ECHO                                                     'Write%21%0A'
  16    13    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 7.2.0