3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Address { public $street; } class User { protected $address; public function __construct(Address $address){ $this->address = $address; } public function getAddress() : Address { return $this->address; } } $user = new User(new Addres()); $address = $user->getAddress(); var_dump($address->street);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/81pGY
function name:  (null)
number of ops:  14
compiled vars:  !0 = $user, !1 = $address
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'User'
          1        NEW                                              $3      'Addres'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   21     6        INIT_METHOD_CALL                                         !0, 'getAddress'
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !1, $7
   22     9        INIT_FCALL                                               'var_dump'
         10        FETCH_OBJ_R                                      ~9      !1, 'street'
         11        SEND_VAL                                                 ~9
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Address: [no user functions]
Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/81pGY
function name:  __construct
number of ops:  4
compiled vars:  !0 = $address
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               'address'
          2        OP_DATA                                                  !0
   12     3      > RETURN                                                   null

End of function __construct

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

End of function getaddress

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.73 ms | 1396 KiB | 15 Q