3v4l.org

run code in 500+ PHP versions simultaneously
<?php class UserName { private string $value; public function __construct(string $value) { $this->value = $value; } public function __invoke() { return $this->value; } } class User { public UserName $name; public function __construct(string $name) { $this->name = new UserName($name); } } // this is run $name = new UserName('sample'); var_dump( $name() ); // this is not run... $user = new User('hoge'); var_dump( ($user->name)() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KB9GY
function name:  (null)
number of ops:  20
compiled vars:  !0 = $name, !1 = $user
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   NEW                                                  $2      'UserName'
          1        SEND_VAL_EX                                                  'sample'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   29     4        INIT_FCALL                                                   'var_dump'
          5        INIT_DYNAMIC_CALL                                            !0
          6        DO_FCALL                                          0  $5      
          7        SEND_VAR                                                     $5
          8        DO_ICALL                                                     
   32     9        NEW                                                  $7      'User'
         10        SEND_VAL_EX                                                  'hoge'
         11        DO_FCALL                                          0          
         12        ASSIGN                                                       !1, $7
   33    13        INIT_FCALL                                                   'var_dump'
         14        FETCH_OBJ_R                                          ~10     !1, 'name'
         15        INIT_DYNAMIC_CALL                                            ~10
         16        DO_FCALL                                          0  $11     
         17        SEND_VAR                                                     $11
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

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

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KB9GY
function name:  __invoke
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                          ~0      'value'
          1      > RETURN                                                       ~0
   14     2*     > RETURN                                                       null

End of function __invoke

End of class UserName.

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KB9GY
function name:  __construct
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
   23     1        NEW                                                  $2      'UserName'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        ASSIGN_OBJ                                                   'name'
          5        OP_DATA                                                      $2
   24     6      > RETURN                                                       null

End of function __construct

End of class User.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
125.1 ms | 482 KiB | 8 Q