Reputation: 171
I am getting an error as read below:
Parse error: syntax error, unexpected '(', expecting ',' or ';' in X:\xampp\htdocs\lib.php on line 15
when I try and save the date to a variable. Here is my code... (PHP)
protected $title = date('D, d M Y');
Upvotes: 0
Views: 736
Reputation: 64536
You should set your property defaults in the constructor:
class Something
{
protected $title;
public function __construct()
{
$this->title = date('D, d M Y');
}
}
Upvotes: 2