3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __construct(array $options) { foreach ($options as $key => $value) { $this->$key = $value; } } } $f = new Foo([1 => 1]); $f->1;
Output for 8.3.5
Parse error: syntax error, unexpected integer "1", expecting identifier or variable or "{" or "$" in /in/o4IRj on line 15
Process exited with code 255.
Output for 5.6.38, 7.1.0 - 7.1.24, 7.2.0 - 7.2.12
Parse error: syntax error, unexpected '1' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/o4IRj on line 15
Process exited with code 255.

preferences:
45.57 ms | 655 KiB | 3 Q