Code has been added to clipboard!

Handle PHP Exceptions

Example
<?php
//creating a function, which throws an exception
function check_num($number) {
  if($number>1) {
    throw new Exception("The value has to be 1 or lower");
  }
  return true;
}

//triggering the exception
check_num(3);
?>