3v4l.org

run code in 300+ PHP versions simultaneously
<?php struct Foo { public string $firstname; public string $lastname; public function __construct(string $firstname, string $lastname) { $this->firstname = strtoupper($firstname); $this->lastname = strtoupper($lastname); } } $foo = Foo { firstname: 'Levi', lastname: 'Morrison' }; var_dump($foo->firstname); var_dump($foo->lastname);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Parse error: syntax error, unexpected identifier "Foo" in /in/9lfMr on line 3
Process exited with code 255.

preferences:
151.83 ms | 1400 KiB | 62 Q