3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Field { const READ = 1; const WRITE = 2; private $name; private $readWriteMask; public function __construct($name, $readWriteMask = null) { $this->name = (string) $name; $this->readWriteMask = $readWriteMask ?: self::READ; } public function getName() { return $this->name; } public function isReadable() { return (bool) $this->readWriteMask & self::READ; } public function isWritable() { return (bool) $this->readWriteMask & self::WRITE; } } $a = new Field('a'); var_dump($a); var_dump($a->isReadable()); var_dump($a->isWritable()); $b = new Field('b', Field::WRITE); var_dump($b); var_dump($b->isReadable()); var_dump($b->isWritable());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVPPF
function name:  (null)
number of ops:  36
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $2      'Field'
          1        SEND_VAL_EX                                              'a'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   31     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   32     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'isReadable'
          9        DO_FCALL                                      0  $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                                 
   33    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'isWritable'
         14        DO_FCALL                                      0  $8      
         15        SEND_VAR                                                 $8
         16        DO_ICALL                                                 
   35    17        NEW                                              $10     'Field'
         18        SEND_VAL_EX                                              'b'
         19        SEND_VAL_EX                                              2
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !1, $10
   36    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
   37    25        INIT_FCALL                                               'var_dump'
         26        INIT_METHOD_CALL                                         !1, 'isReadable'
         27        DO_FCALL                                      0  $14     
         28        SEND_VAR                                                 $14
         29        DO_ICALL                                                 
   38    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !1, 'isWritable'
         32        DO_FCALL                                      0  $16     
         33        SEND_VAR                                                 $16
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Class Field:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVPPF
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $readWriteMask
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   12     2        CAST                                          6  ~3      !0
          3        ASSIGN_OBJ                                               'name'
          4        OP_DATA                                                  ~3
   13     5        JMP_SET                                          ~5      !1, ->7
          6        QM_ASSIGN                                        ~5      1
          7        ASSIGN_OBJ                                               'readWriteMask'
          8        OP_DATA                                                  ~5
   14     9      > RETURN                                                   null

End of function __construct

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVPPF
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function getname

Function isreadable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVPPF
function name:  isReadable
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'readWriteMask'
          1        BOOL                                             ~1      ~0
          2        BW_AND                                           ~2      ~1, 1
          3      > RETURN                                                   ~2
   22     4*     > RETURN                                                   null

End of function isreadable

Function iswritable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVPPF
function name:  isWritable
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~0      'readWriteMask'
          1        BOOL                                             ~1      ~0
          2        BW_AND                                           ~2      ~1, 2
          3      > RETURN                                                   ~2
   26     4*     > RETURN                                                   null

End of function iswritable

End of class Field.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.36 ms | 1392 KiB | 15 Q