3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $bar; function __construct($foo) { $this->bar = $foo; } public function test() { $i = new static('hi'); echo get_class($i) . $i->bar; } } class B extends A { } $a = new A('womp'); $a->test(); $b = new B('buh'); $b->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GH4IX
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'A'
          1        SEND_VAL_EX                                              'womp'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   21     4        INIT_METHOD_CALL                                         !0, 'test'
          5        DO_FCALL                                      0          
   23     6        NEW                                              $6      'B'
          7        SEND_VAL_EX                                              'buh'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   24    10        INIT_METHOD_CALL                                         !1, 'test'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

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

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GH4IX
function name:  test
number of ops:  9
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                          static              $1      
          1        SEND_VAL_EX                                              'hi'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   13     4        GET_CLASS                                        ~4      !0
          5        FETCH_OBJ_R                                      ~5      !0, 'bar'
          6        CONCAT                                           ~6      ~4, ~5
          7        ECHO                                                     ~6
   14     8      > RETURN                                                   null

End of function test

End of class A.

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

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GH4IX
function name:  test
number of ops:  9
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                          static              $1      
          1        SEND_VAL_EX                                              'hi'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   13     4        GET_CLASS                                        ~4      !0
          5        FETCH_OBJ_R                                      ~5      !0, 'bar'
          6        CONCAT                                           ~6      ~4, ~5
          7        ECHO                                                     ~6
   14     8      > RETURN                                                   null

End of function test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.57 ms | 1399 KiB | 13 Q