While in PHP's interactive mode, I tried the following:
php > namespace MyNamespace;
php > class Throwable {}
This results in a fatal error:
PHP Fatal error: Cannot declare class Throwable, because the name is already in use in php shell code on line 1
However, the following code, when in a PHP file, executes without errors:
<?php
namespace MyNamespace;
class Throwable {}
Therefore, is it possible to somehow set a namespace while in interactive mode? Or, is all code in interactive mode run in the global space regardless of a previous namespace definition?