3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyBitmask { const POS_1 = 1; // const POS_2 = 2; // reserved/undefined // const POS_3 = 3; // reserved/undefined const POS_4 = 4; private $b = 0x0000; function setChecked($pos) { if (in_array($pos, (new ReflectionClass($this))->getConstants())) { $this->set($pos); } return $this; } function set($pos) { $this->b |= 1 << ($pos - 1); return $this; } } $b = new MyBitmask(); var_dump($b->setChecked(2)); var_dump($b->set(2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j4vuJ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   NEW                                                  $1      'MyBitmask'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   26     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'setChecked'
          5        SEND_VAL_EX                                                  2
          6        DO_FCALL                                          0  $4      
          7        SEND_VAR                                                     $4
          8        DO_ICALL                                                     
   27     9        INIT_FCALL                                                   'var_dump'
         10        INIT_METHOD_CALL                                             !0, 'set'
         11        SEND_VAL_EX                                                  2
         12        DO_FCALL                                          0  $6      
         13        SEND_VAR                                                     $6
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

Class MyBitmask:
Function setchecked:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/j4vuJ
function name:  setChecked
number of ops:  15
compiled vars:  !0 = $pos
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   11     1        NEW                                                  $1      'ReflectionClass'
          2        FETCH_THIS                                           $2      
          3        SEND_VAR_EX                                                  $2
          4        DO_FCALL                                          0          
          5        INIT_METHOD_CALL                                             $1, 'getConstants'
          6        DO_FCALL                                          0  $4      
          7        FRAMELESS_ICALL_2                in_array            ~5      !0, $4
          8      > JMPZ                                                         ~5, ->12
   12     9    >   INIT_METHOD_CALL                                             'set'
         10        SEND_VAR_EX                                                  !0
         11        DO_FCALL                                          0          
   15    12    >   FETCH_THIS                                           ~7      
         13      > RETURN                                                       ~7
   16    14*     > RETURN                                                       null

End of function setchecked

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j4vuJ
function name:  set
number of ops:  8
compiled vars:  !0 = $pos
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
   19     1        SUB                                                  ~2      !0, 1
          2        SL                                                   ~3      1, ~2
          3        ASSIGN_OBJ_OP                                     9          'b'
          4        OP_DATA                                                      ~3
   21     5        FETCH_THIS                                           ~4      
          6      > RETURN                                                       ~4
   22     7*     > RETURN                                                       null

End of function set

End of class MyBitmask.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.88 ms | 2732 KiB | 14 Q