This question already has an answer here:
I have a class that I need to use php's time()
function in:
<?php
class SomeClass {
public $expiration = time() + (21 * 24 * 60 * 60); // 3 wks from now
}
However this throws:
Parse error: syntax error, unexpected '(', expecting ',' or ';' in [...][...] on line 5
I can do this and it works:
<?php
class SomeClass {
public $expiration = 0
function __construct() {
$this->expiration = time() + (21 * 24 * 60 * 60);
}
}
Why is it that I can't do it the first way?
</div>