Answer the question
In order to leave comments, you need to log in
Why is catching the exception not working?
Good day.
Made this code:
<?php
function foo(
string $m): void{
if(!is_string($m)){
throw new Exception('не строка');
}
}
try{
foo(15);
}
catch(Exception $e){
echo 'перехваченное исключение', $e->getMessage();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question