3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Button { public string $text = ''; public string $type = 'button' { set { $this->type = $value; } } } $var = new Button(); $var->text = 'hey'; $var->type = 'bazongas'; print_r($var);
Output for 8.4.1 - 8.4.3
Button Object ( [text] => hey [type] => bazongas )
Output for 8.2.0 - 8.2.27, 8.3.0 - 8.3.16
Parse error: syntax error, unexpected token ";" in /in/OF1EF on line 9
Process exited with code 255.

preferences:
147.74 ms | 954 KiB | 7 Q