3v4l.org

run code in 300+ PHP versions simultaneously
<?php // File "load.php". namespace Foo\Bar { class load { static public function arithmetic() { require_once __DIR__ . '/arithmetic.php'; } } } // File "arithmetic.php". namespace Foo\Bar\Functions { function add($a, $b) { return $a + $b; } const add = 'Foo\Bar\Functions\add'; } // User app. namespace Some\App { use Foo\Bar\load; use Foo\Bar\Functions as f; load::arithmetic(); echo f\add(5, 6) . "\n"; // 11 $callable = f\add; echo $callable(5, 6); // 11 }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: require_once(/in/arithmetic.php): Failed to open stream: No such file or directory in /in/C3qjv on line 7 Fatal error: Uncaught Error: Failed opening required '/in/arithmetic.php' (include_path='.:') in /in/C3qjv:7 Stack trace: #0 /in/C3qjv(26): Foo\Bar\load::arithmetic() #1 {main} thrown in /in/C3qjv on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
31.9 ms | 401 KiB | 8 Q