2. TRY BLOCK
Handle errors using try catch error like in
many other programing languages.
We Allow to thrown the exceptions in the
catch block , so the main code will not
be halted.
Try{
//code….
}
3. CATCH BLOCK
When thrown exception no code in try
block will executed and we can display
the error using built in PHP capability
“Exception”.
catch{
echo catch(Exception $e)
//code….
}
4. EXCEPTION CLASS
Class constructor can take three optional
parameters.
Class provide number of methods.
getMessage()
getFile()
getLine()