<?php
//create function with an exception
function checkNum($number) {
if($number>1) {
throw new Exception("Value must be 1 or below");
}
return true;
}
//trigger exception
checkNum(2);
?>
Fatal error: Uncaught Exception: Value must be 1 or below in /in/HK2gr:5
Stack trace:
#0 /in/HK2gr(11): checkNum(2)
#1 {main}
thrown in /in/HK2gr on line 5
Process exited with code 255.
Fatal error: Uncaught exception 'Exception' with message 'Value must be 1 or below' in /in/HK2gr:5
Stack trace:
#0 /in/HK2gr(11): checkNum(2)
#1 {main}
thrown in /in/HK2gr on line 5
Process exited with code 255.