3v4l.org

run code in 300+ PHP versions simultaneously
<?php const FLAG_1 = 0b0001; // 1 const FLAG_2 = 0b0010; // 2 const FLAG_3 = 0b0100; // 4 const FLAG_4 = 0b1000; // 8 // Can you see the pattern? ;-) function show_flags ($flags) { if ($flags & FLAG_1) { echo "You passed flag 1!<br>\n"; } if ($flags & FLAG_2) { echo "You passed flag 2!<br>\n"; } if ($flags & FLAG_3) { echo "You passed flag 3!<br>\n"; } if ($flags & FLAG_4) { echo "You passed flag 4!<br>\n"; } } show_flags(FLAG_1 | FLAG_3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tTZnW
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'FLAG_1', 1
    4     1        DECLARE_CONST                                            'FLAG_2', 2
    5     2        DECLARE_CONST                                            'FLAG_3', 4
    6     3        DECLARE_CONST                                            'FLAG_4', 8
   24     4        INIT_FCALL                                               'show_flags'
          5        FETCH_CONSTANT                                   ~0      'FLAG_1'
          6        FETCH_CONSTANT                                   ~1      'FLAG_3'
          7        BW_OR                                            ~2      ~0, ~1
          8        SEND_VAL                                                 ~2
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Function show_flags:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 13
Branch analysis from position: 9
Branch analysis from position: 5
filename:       /in/tTZnW
function name:  show_flags
number of ops:  18
compiled vars:  !0 = $flags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        FETCH_CONSTANT                                   ~1      'FLAG_1'
          2        BW_AND                                           ~2      !0, ~1
          3      > JMPZ                                                     ~2, ->5
   11     4    >   ECHO                                                     'You+passed+flag+1%21%3Cbr%3E%0A'
   13     5    >   FETCH_CONSTANT                                   ~3      'FLAG_2'
          6        BW_AND                                           ~4      !0, ~3
          7      > JMPZ                                                     ~4, ->9
   14     8    >   ECHO                                                     'You+passed+flag+2%21%3Cbr%3E%0A'
   16     9    >   FETCH_CONSTANT                                   ~5      'FLAG_3'
         10        BW_AND                                           ~6      !0, ~5
         11      > JMPZ                                                     ~6, ->13
   17    12    >   ECHO                                                     'You+passed+flag+3%21%3Cbr%3E%0A'
   19    13    >   FETCH_CONSTANT                                   ~7      'FLAG_4'
         14        BW_AND                                           ~8      !0, ~7
         15      > JMPZ                                                     ~8, ->17
   20    16    >   ECHO                                                     'You+passed+flag+4%21%3Cbr%3E%0A'
   22    17    > > RETURN                                                   null

End of function show_flags

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.49 ms | 1453 KiB | 14 Q