- Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
- Parse error: syntax error, unexpected 'extend' (T_STRING), expecting '{' in /in/irkIN on line 2
Process exited with code 255.
<?php
class cust extend Exception {
public function errorMessage() {
$errorMsg = 'error on line ' .$this->getLine(). ' in '.$this->getFle().': <b>' .$this->geMessage().'</b> is not a valid e-mail address';
return $errorMsg;
}
}
$emial = "someone@example.com";
try {
if(filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
throw new customException($emial);
}
if(strpos($email,"example") !== FALSE) {
throw new Exception("emial is an example e-mail");
}
}
catch (customException $e) {
echo $e->errorMessage();
}
catch(Excception $e) {
echo $e->getMessage();
}
?>