3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Entity { use Entity\FileInbox\File; class File { private $foo = 'top'; } class FileInbox { public $file; public function setFile(File $file) { $this->file = $file; } } } namespace Entity\FileInbox { class File { private $foo = 'nested'; } } namespace Test { use Entity\FileInbox; use Entity\FileInbox\File; $fileInbox = new FileInbox(); $fileInbox->setFile(new File()); var_dump($fileInbox->file->foo); }
based on 2IZFM
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/DkEXp
function name:  (null)
number of ops:  17
compiled vars:  !0 = $fileInbox
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   NOP                                                      
  10     1        NOP                                                      
  20     2        NOP                                                      
  29     3        NEW                                              $4      :-6
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !0, $4
  30     6        INIT_METHOD_CALL                                         !0, 'setFile'
         7        NEW                                              $7      :-2
         8        DO_FCALL                                      0          
         9        SEND_VAR_NO_REF                               0          $7
        10        DO_FCALL                                      0          
  31    11        INIT_NS_FCALL_BY_NAME                                    
        12        FETCH_OBJ_FUNC_ARG                               $10     !0, 'file'
        13        FETCH_OBJ_FUNC_ARG                               $11     $10, 'foo'
        14        SEND_VAR_EX                                              $11
        15        DO_FCALL                                      0          
        16      > RETURN                                                   1

Class Entity\File: [no user functions]
Class Entity\FileInbox:
Function setfile:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/DkEXp
function name:  setFile
number of ops:  4
compiled vars:  !0 = $file
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   RECV                                             !0      
  14     1        ASSIGN_OBJ                                               'file'
         2        OP_DATA                                                  !0
  15     3      > RETURN                                                   null

End of function setfile

End of class Entity\FileInbox.

Class Entity\FileInbox\File: [no user functions]

Generated using Vulcan Logic Dumper, using php 7.3.0