Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GPS_Coord extends Exception{}
- class OutputCoord extends Exception {}
- class ErorrNullable extends Exception{}
- function drawPoint($point){
- if ($point!=0){
- if (is_string($point)){
- throw new GPS_Coord("Это строка!!", 200);
- }
- elseif($point > 500 && $point<10){
- throw new OutputCoord("point >500 Erorr input user!", 300);
- }
- else return $point;
- }
- else throw new ErorrNullable("Nullable number! Error",100);
- }
- try {
- echo drawPoint(3);
- }catch(GPS_Coord $e){
- echo $e->getMessage();
- }catch(OutputCoord $e){
- echo $e->getMessage();
- }catch(ErorrNullable $e){
- echo $e->getMessage();
- }
Add Comment
Please, Sign In to add comment