3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class A { public function __construct(private int $id) { } } $a1 = new A(42); $a2 = new A(42); $a3 = new A(23); var_dump($a1 == $a2); var_dump($a2 == $a3); var_dump($a1 === $a2); var_dump($a2 === $a3);
Output for 8.0.0 - 8.0.8
bool(true) bool(false) bool(false) bool(false)
Output for 7.3.0 - 7.3.29, 7.4.0 - 7.4.21
Parse error: syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE) in /in/Y1p3S on line 5
Process exited with code 255.

preferences:
136.03 ms | 460 KiB | 5 Q