3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PropertyTest { private $data = array(); public function __set($name, $value) { echo "Setting '$name' to '$value'\n"; $this->data[$name] = $value; } public function __get($name) { echo "Getting '$name'\n"; if (array_key_exists($name, $this->data)) { return $this->data[$name]; }} public function __isset($name) { echo "Is '$name' set?\n"; return isset($this->data[$name]); } } echo "<pre>\n"; $obj = new PropertyTest; $obj->a = 1; echo $obj->a . "\n\n"; var_dump(isset($obj->a)); unset($obj->a); var_dump(isset($obj->a)); echo "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADlgo
function name:  (null)
number of ops:  20
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   ECHO                                                     '%3Cpre%3E%0A'
   29     1        NEW                                              $1      'PropertyTest'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   31     4        ASSIGN_OBJ                                               !0, 'a'
          5        OP_DATA                                                  1
   32     6        FETCH_OBJ_R                                      ~5      !0, 'a'
          7        CONCAT                                           ~6      ~5, '%0A%0A'
          8        ECHO                                                     ~6
   33     9        INIT_FCALL                                               'var_dump'
         10        ISSET_ISEMPTY_PROP_OBJ                           ~7      !0, 'a'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
   34    13        UNSET_OBJ                                                !0, 'a'
   35    14        INIT_FCALL                                               'var_dump'
         15        ISSET_ISEMPTY_PROP_OBJ                           ~9      !0, 'a'
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                                 
   36    18        ECHO                                                     '%0A'
   39    19      > RETURN                                                   1

Class PropertyTest:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADlgo
function name:  __set
number of ops:  12
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ROPE_INIT                                     5  ~3      'Setting+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_ADD                                      2  ~3      ~3, '%27+to+%27'
          5        ROPE_ADD                                      3  ~3      ~3, !1
          6        ROPE_END                                      4  ~2      ~3, '%27%0A'
          7        ECHO                                                     ~2
   10     8        FETCH_OBJ_W                                      $6      'data'
          9        ASSIGN_DIM                                               $6, !0
         10        OP_DATA                                                  !1
   11    11      > RETURN                                                   null

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADlgo
function name:  __get
number of ops:  12
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ROPE_INIT                                     3  ~2      'Getting+%27'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%27%0A'
          4        ECHO                                                     ~1
   15     5        FETCH_OBJ_R                                      ~4      'data'
          6        ARRAY_KEY_EXISTS                                         !0, ~4
          7      > JMPZ                                                     ~5, ->11
   16     8    >   FETCH_OBJ_R                                      ~6      'data'
          9        FETCH_DIM_R                                      ~7      ~6, !0
         10      > RETURN                                                   ~7
   17    11    > > RETURN                                                   null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADlgo
function name:  __isset
number of ops:  9
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        ROPE_INIT                                     3  ~2      'Is+%27'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%27+set%3F%0A'
          4        ECHO                                                     ~1
   21     5        FETCH_OBJ_IS                                     ~4      'data'
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, !0
          7      > RETURN                                                   ~5
   22     8*     > RETURN                                                   null

End of function __isset

End of class PropertyTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.06 ms | 1392 KiB | 15 Q