3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { public static int $int = 1; public string $string = 'abc'; } function foo() { $foo = new X(); $varString = &$foo->string; $varString = []; //Cannot assign array to reference held by property X::$string of type string $varInt = &X::$int; $varInt = 'abc'; //Cannot assign string to reference held by property X::$int of type int } foo();
Output for git.master_jit, git.master
Fatal error: Uncaught TypeError: Cannot assign array to reference held by property X::$string of type string in /in/H1uAS:12 Stack trace: #0 /in/H1uAS(21): foo() #1 {main} thrown in /in/H1uAS on line 12
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:
40.3 ms | 865 KiB | 4 Q