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 render($flags, $flag) { $result = FALSE; if ($flags & $flag) { $result = TRUE; } echo $result; } render(FLAG_4 | FLAG_3 | FLAG_1, FLAG_1 | FLAG_2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pqIvl
function name:  (null)
number of ops:  17
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
   19     4        INIT_FCALL                                               'render'
          5        FETCH_CONSTANT                                   ~0      'FLAG_4'
          6        FETCH_CONSTANT                                   ~1      'FLAG_3'
          7        BW_OR                                            ~2      ~0, ~1
          8        FETCH_CONSTANT                                   ~3      'FLAG_1'
          9        BW_OR                                            ~4      ~2, ~3
         10        SEND_VAL                                                 ~4
         11        FETCH_CONSTANT                                   ~5      'FLAG_1'
         12        FETCH_CONSTANT                                   ~6      'FLAG_2'
         13        BW_OR                                            ~7      ~5, ~6
         14        SEND_VAL                                                 ~7
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Function render:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/pqIvl
function name:  render
number of ops:  8
compiled vars:  !0 = $flags, !1 = $flag, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ASSIGN                                                   !2, <false>
   13     3        BW_AND                                           ~4      !0, !1
          4      > JMPZ                                                     ~4, ->6
   14     5    >   ASSIGN                                                   !2, <true>
   16     6    >   ECHO                                                     !2
   17     7      > RETURN                                                   null

End of function render

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.04 ms | 1398 KiB | 14 Q