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 const FLAG_5 = 0b1001; // 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"; } if ($flags & FLAG_5) { echo "You passed flag 5!<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/j6ICA
function name:  (null)
number of ops:  12
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
    7     4        DECLARE_CONST                                            'FLAG_5', 9
   29     5        INIT_FCALL                                               'show_flags'
          6        FETCH_CONSTANT                                   ~0      'FLAG_1'
          7        FETCH_CONSTANT                                   ~1      'FLAG_3'
          8        BW_OR                                            ~2      ~0, ~1
          9        SEND_VAL                                                 ~2
         10        DO_FCALL                                      0          
         11      > 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
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 17
Branch analysis from position: 13
Branch analysis from position: 9
Branch analysis from position: 5
filename:       /in/j6ICA
function name:  show_flags
number of ops:  22
compiled vars:  !0 = $flags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        FETCH_CONSTANT                                   ~1      'FLAG_1'
          2        BW_AND                                           ~2      !0, ~1
          3      > JMPZ                                                     ~2, ->5
   13     4    >   ECHO                                                     'You+passed+flag+1%21%3Cbr%3E%0A'
   15     5    >   FETCH_CONSTANT                                   ~3      'FLAG_2'
          6        BW_AND                                           ~4      !0, ~3
          7      > JMPZ                                                     ~4, ->9
   16     8    >   ECHO                                                     'You+passed+flag+2%21%3Cbr%3E%0A'
   18     9    >   FETCH_CONSTANT                                   ~5      'FLAG_3'
         10        BW_AND                                           ~6      !0, ~5
         11      > JMPZ                                                     ~6, ->13
   19    12    >   ECHO                                                     'You+passed+flag+3%21%3Cbr%3E%0A'
   21    13    >   FETCH_CONSTANT                                   ~7      'FLAG_4'
         14        BW_AND                                           ~8      !0, ~7
         15      > JMPZ                                                     ~8, ->17
   22    16    >   ECHO                                                     'You+passed+flag+4%21%3Cbr%3E%0A'
   24    17    >   FETCH_CONSTANT                                   ~9      'FLAG_5'
         18        BW_AND                                           ~10     !0, ~9
         19      > JMPZ                                                     ~10, ->21
   25    20    >   ECHO                                                     'You+passed+flag+5%21%3Cbr%3E%0A'
   27    21    > > RETURN                                                   null

End of function show_flags

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.63 ms | 1403 KiB | 14 Q