Fatal error: Constant expression contains invalid operations in C:\xampp\htdocs\test\php_tests\app\controller\auth\Token.php on line 18
protected $token = [
'csrf' => random_int(0, 500) // line 18
];
Hi, that is the error that I get. I need that space to generate a random number but it gives me an error
Your code should look like this:
Resulting, for example:
Explanation
Option 1
Option 2
token
within it by matching it to the dynamic result offered by the methodrandom_int()
$obj
$obj
accessing the methodaleatorio()
returns