Closed
Description
Description
The following code:
<?php
$a = new readonly class {
public int $x;
function __construct() {
$this->x = 2;
}
};
var_dump($a->x);
Resulted in this output:
Parse error: syntax error, unexpected token "readonly" in /in/3uciU on line 3
But I expected this output instead:
int(2)
PHP Version
PHP 8.2.1
Operating System
No response