3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo { class Bar { function __construct(){ echo get_called_class() . PHP_EOL; echo get_class($this) . PHP_EOL; echo __CLASS__ . PHP_EOL; echo get_class(self) . PHP_EOL; if (version_compare(PHP_VERSION, '5.5.0') >= 0) { echo ClassName::class . PHP_EOL; } } } $oBar = new Bar(); } #EOF
Output for git.master, git.master_jit, rfc.property-hooks
Foo\Bar Foo\Bar Foo\Bar Fatal error: Uncaught Error: Undefined constant "Foo\self" in /in/HW9jr:10 Stack trace: #0 /in/HW9jr(17): Foo\Bar->__construct() #1 {main} thrown in /in/HW9jr on line 10
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:
43.98 ms | 401 KiB | 8 Q