syntax error, unexpected 'for' (T_FOR), expecting identifier (T_STRING)
public function for($user)
{
$this->user = $user;
return $this;
}
syntax error, unexpected 'for' (T_FOR), expecting identifier (T_STRING)
public function for($user)
{
$this->user = $user;
return $this;
}
for
is a reserved keyword in php (and most other languages). This means that you can't use it as a function or variable name. If you rename your function to something like setUser
it should all be fine.
public function setUser($user) {
$this->user = $user;
return $this;
}
You can find a list of other reserved keywords here: http://php.net/manual/en/reserved.keywords.php