3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class C { private $s; public function __construct($s) { $this->s = $s; } //or protected function getS() { public final function __toString() { return $this->s; } } class C1 extends C { public function __get($name) { $value = 'wanted:'.$name; $this->$name = $value.',got it again'; return $value; } public function __construct($s1) { parent::__construct($s1); } function doStuff() { echo $this."\n"; echo $this->s."\n"; echo $this->s."\n"; } } $c1 = new C1('foo'); $c1->doStuff();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LQDZQ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $c1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'c'
   14     1        DECLARE_CLASS                                            'c1', 'c'
   30     2        NEW                                              $1      'C1'
          3        SEND_VAL_EX                                              'foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   31     6        INIT_METHOD_CALL                                         !0, 'doStuff'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LQDZQ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               's'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LQDZQ
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~0      's'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   11     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function __tostring

End of class C.

Class C1:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LQDZQ
function name:  __get
number of ops:  8
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        CONCAT                                           ~2      'wanted%3A', !0
          2        ASSIGN                                                   !1, ~2
   17     3        CONCAT                                           ~5      !1, '%2Cgot+it+again'
          4        ASSIGN_OBJ                                               !0
          5        OP_DATA                                                  ~5
   18     6      > RETURN                                                   !1
   19     7*     > RETURN                                                   null

End of function __get

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LQDZQ
function name:  __construct
number of ops:  5
compiled vars:  !0 = $s1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   22     4      > RETURN                                                   null

End of function __construct

Function dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LQDZQ
function name:  doStuff
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_THIS                                       ~0      
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
   25     3        FETCH_OBJ_R                                      ~2      's'
          4        CONCAT                                           ~3      ~2, '%0A'
          5        ECHO                                                     ~3
   26     6        FETCH_OBJ_R                                      ~4      's'
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
   27     9      > RETURN                                                   null

End of function dostuff

End of class C1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.71 ms | 1399 KiB | 13 Q