Why different results in cli and browser?

<?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?
July 9th 19 at 13:25
1 answer
July 9th 19 at 13:27
What could be the reason?
That error output is turned off.
Error output and. All other errors are reported. The more fatal error. for example, if you swap rows
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
Clarify the question. Why is the browser not to display this error? - Gia_Schiller commented on July 9th 19 at 13:33

Find more questions by tags PHP