<?php
namespace App{
class Exception extends \Exception{}
use App\Di\Exception;
class Di{}
}
namespace App\Di{
class Exception extends \App\Exception{}
}</property-->
br><br>
In the cli we get:<br><pre><code>PHP Fatal error: Cannot use App\Di\Exception as Exception because the name is already in use in /home/bulat/www/test/namespaces/index.php on line 4</code></pre><br>
And understandably so. All right.<br>
But in the browser everything is OK - no Fatal error.<br>
What could be the reason?
What could be the reason?That error output is turned off.
Find more questions by tags PHP
class Exception extends \Exception{}
and
use App\Di\Exception;
then in the browser and the cli get
Fatal error: Cannot declare class App\Exception because the name is already in use in /home/bulat/www/test/namespaces/index.php on line 4 - Gia_Schiller commented on July 9th 19 at 13:30