abstract class Database {
abstract public function connection();
protected $server = "54.215.23.228";
protected $database = "db-west-03";
protected $user = "bigcheese";
protected $pass = "4G_8*-21Rt7";
public function disconnect() {
// disconnect from server
}
}
class Mysql extends Database {
public $connection = "open";
public function connection() {
echo "PARAMS:<br>Server: " . $this->server . "<br>\n";
echo "Database: " . $this->database . "<br>\n";
echo "User: " . $this->user . "<br>\n";
echo "Pass: " . $this->pass . "<br>\n";
}
public function disconnect() {
// disconnect from server
$this->connection = "closed";
}
}
// YOU NEVER WANT TO INSTANTIATE AN ABSTRACT CLASS
//$db = new Database();
$mysql = new Mysql();
$mysql->connection();
$mysql->disconnect();
echo "Connection: " . $mysql->connection;