I have a Config class with:
class Config{
[...]
public static function url()
{
if(self::debug)
return "https://localhost:44300";
else
return "https://www.mysite.com";
}
[...]
}
then a class to manage Facebook logins, where I want to define a string with the callback uri:
class Fb
{
public static $login_redirecturi = Config::url() . "/login/";
[...]
}
But I can't understand why it gives an error:
Parse error: syntax error, unexpected '(', expecting ',' or ';' in [...] on line 20
How can I do?
You can't call methods on property declarations.
From the PHP docs:
This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated.