3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { public static function test(X $x) { var_dump($x); if (version_compare(PHP_VERSION, '8.1') >= 0) { var_dump(serialize($x)); } } } class Y extends X { protected $value = 1; protected function __debugInfo() { return array('value' => $this->value); } protected function __sleep() { return array('value'); } protected function __destruct() {} } X::test(new X()); X::test(new Y());
Output for git.master, git.master_jit, rfc.property-hooks
Warning: The magic method Y::__debugInfo() must have public visibility in /in/6DFGp on line 15 Warning: The magic method Y::__sleep() must have public visibility in /in/6DFGp on line 19 object(X)#1 (0) { } string(12) "O:1:"X":0:{}" object(Y)#1 (1) { ["value"]=> int(1) } string(31) "O:1:"Y":1:{s:8:"*value";i:1;}" Fatal error: Uncaught Error: Call to protected Y::__destruct() from global scope in /in/6DFGp:27 Stack trace: #0 {main} thrown in /in/6DFGp on line 27
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:
71.22 ms | 406 KiB | 5 Q