3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $_prot; public function __toString() { return (string) $this->_prot; } } class C extends A { protected $_c = __CLASS__; } class B extends A { static function test(A $a) { $a->_prot = 5; echo '_c:', $a->_c, " "; echo "_a:", $a, "\n"; } } $a = new A; $b = new B; $c = new C; B::test($a); B::test($b); B::test($c);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qgt77
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   10     1        DECLARE_CLASS                                            'c', 'a'
   14     2        DECLARE_CLASS                                            'b', 'a'
   22     3        NEW                                              $3      'A'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   23     6        NEW                                              $6      'B'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   24     9        NEW                                              $9      'C'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $9
   26    12        INIT_STATIC_METHOD_CALL                                  'B', 'test'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
   27    15        INIT_STATIC_METHOD_CALL                                  'B', 'test'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
   28    18        INIT_STATIC_METHOD_CALL                                  'B', 'test'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0          
         21      > RETURN                                                   1

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

End of function __tostring

End of class A.

Class C: [no user functions]
Class B:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qgt77
function name:  test
number of ops:  11
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ASSIGN_OBJ                                               !0, '_prot'
          2        OP_DATA                                                  5
   17     3        ECHO                                                     '_c%3A'
          4        FETCH_OBJ_R                                      ~2      !0, '_c'
          5        ECHO                                                     ~2
          6        ECHO                                                     '+'
   18     7        ECHO                                                     '_a%3A'
          8        ECHO                                                     !0
          9        ECHO                                                     '%0A'
   19    10      > RETURN                                                   null

End of function test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.32 ms | 1399 KiB | 13 Q