3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo PHP_VERSION; namespace MyProject { const CONNECT_OK = 1; class Connection { static public function start() { echo 'started'; } } function connect() { /* ... */ } } namespace { // global code session_start(); $a = MyProject\connect(); echo MyProject\Connection::start(); }
Output for 5.3.0 - 5.3.18, 5.4.0 - 5.4.8
Fatal error: Namespace declaration statement has to be the very first statement in the script in /in/XOb0H on line 3
Process exited with code 255.

preferences:
169.32 ms | 1395 KiB | 35 Q