I have an helper class like this:
class Helper{
public static $app_url = self::getServerUrl();
/**
* Gets server url path
*/
public static function getServerUrl(){
global $cfg; // get variable cfg as global variable from config.php Modified by Gentle
$port = $_SERVER['SERVER_PORT'];
$http = "http";
if($port == "80"){
$port = "";
}
if(!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"){
$http = "https";
}
if(empty($port)){
return $http."://".$_SERVER['SERVER_NAME']."/".$cfg['afn'];
}else{
return $http."://".$_SERVER['SERVER_NAME'].":".$port."/".$cfg['afn'];
}
}
}
And its given me:
Parse error: syntax error, unexpected '(' on the line with public static $app_url = self::getServerUrl();