3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { function test(): self { return $this; } } class Y extends X { } $x = new Y; $y = $x->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TvJjC
function name:  (null)
number of ops:  7
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $2      'Y'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   18     3        INIT_METHOD_CALL                                             !0, 'test'
          4        DO_FCALL                                          0  $5      
          5        ASSIGN                                                       !1, $5
          6      > RETURN                                                       1

Class X:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TvJjC
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                           ~0      
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
    8     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function test

End of class X.

Class Y:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TvJjC
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                           ~0      
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
    8     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function test

End of class Y.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
254.39 ms | 2831 KiB | 13 Q