Why is this giving error?
class content {
protected $id,$title,$content,$image,$imagedirectory,$page;
protected $sid = md5(time()); //In this line : parse error, expecting `','' or `';''
}
Why is this giving error?
class content {
protected $id,$title,$content,$image,$imagedirectory,$page;
protected $sid = md5(time()); //In this line : parse error, expecting `','' or `';''
}
md5(time())
is an expression.
Field initializations are not allowed to use expressions, only literals.
Instead, you could do:
class content {
protected $id, $title, $content, $image, $imagedirectory, $page, $sid;
public function __construct()
{
$this->sid = md5(time());
}
}