3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Entity { 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; $fileInbox = new FileInbox(); $fileInbox->setFile(new File()); var_dump($fileInbox->file->foo); }
based on T4kng
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'Test\File' not found in /in/JLLVB:27 Stack trace: #0 {main} thrown in /in/JLLVB on line 27
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Class 'Test\File' not found in /in/JLLVB on line 27
Process exited with code 255.