I have a class Config. Whenever 'localhost' is in $_SERVER['HTTP_HOST'], I want the $db_host to be 'localhost'. By default it should be 'defaulthost';
class Config {
public static $db_username = 'username';
public static $db_password = 'password';
public static $db_database = 'database';
public function __construct() {
$host = 'defaulthost';
if(stristr($_SERVER['HTTP_HOST'],'localhost')){
$host = 'localhost';
};
self::$db_host = $host;
}
}
This code is giving me an error
public static $db_host;should fix that up...