3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { public $p = 3; function __construct() { $this->p = 4; } } //Cannot create Closure for new expression //$c = new X(...); $x = new x(); echo $x->p; $x->p = 5; echo $x->p; $f = $x->__construct(...); $f(); echo $x->p;
Output for 8.5.3 - 8.5.7
454
Output for 8.0.14
Parse error: syntax error, unexpected token ")" in /in/k57Tp on line 18
Process exited with code 255.

preferences:
58.73 ms | 496 KiB | 4 Q