3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @property string $value */ class Example { private $value; public function __construct() { $this->value = "test"; } public function __get($key) { if (property_exists($this, $key)) { return $this->{$key}; } else { return null; // or throw an exception } } public function __set($key, $value) { return; // or throw an exception } } $example = new Example(); var_dump($example->value); $example->value = "invalid"; var_dump($example->value);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MFavG
function name:  (null)
number of ops:  14
compiled vars:  !0 = $example
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'Example'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   31     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'value'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   32     7        ASSIGN_OBJ                                               !0, 'value'
          8        OP_DATA                                                  'invalid'
   33     9        INIT_FCALL                                               'var_dump'
         10        FETCH_OBJ_R                                      ~7      !0, 'value'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Example:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MFavG
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN_OBJ                                               'value'
          1        OP_DATA                                                  'test'
   13     2      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MFavG
function name:  __get
number of ops:  12
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'property_exists'
          2        FETCH_THIS                                       ~1      
          3        SEND_VAL                                                 ~1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->10
   18     7    >   FETCH_OBJ_R                                      ~3      !0
          8      > RETURN                                                   ~3
          9*       JMP                                                      ->11
   20    10    > > RETURN                                                   null
   22    11*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MFavG
function name:  __set
number of ops:  4
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2      > RETURN                                                   null
   27     3*     > RETURN                                                   null

End of function __set

End of class Example.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.89 ms | 1400 KiB | 17 Q