3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $test; function setTest($test) { $this->test = $test; return $this; } } class Bar extends Foo { function setTest($test) : Bar { return parent::setTest($test); } } var_dump((new Bar)->setTest('test'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YdB8s
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Bar'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'setTest'
          4        SEND_VAL_EX                                              'test'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function settest

End of class Foo.

Class Bar:
Function settest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YdB8s
function name:  setTest
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_STATIC_METHOD_CALL                                  'setTest'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   14     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function settest

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.87 ms | 999 KiB | 14 Q