till now I have never done anything dealing with exceptions.
Now I have to deal with exception. Basically I have function below which I want to wrap in try/exception. I want to connect to database and if database connection failed then it should catch exception that will do some stuffs and then return false.
If successful it just returns true.
Can one explain with grain of salt how exceptions are done in PHP. I have tried a lot to read but I get lost. I have only experience with Python exceptions that are a lot easier than in PHP
here is a function in question
public function __construct() {
$conn = mysql_connect($this->dbuser, $this->dbpass , $this->dbhost) or die("Cannot connect to database: Error - ".mysql_error());
mysql_select_db($this->dbname);
return $conn;
}