Answers for "php try catch non object"

PHP
0

php try catch non object

// try..catch works on thrown exceptions. Errors are not exceptions. 
// You can silence errors, but please don't do that. 
// Instead, properly check what you're getting:

$result = Model()->find('id=1');
if ($result) {
    $id = $result->id;
} else {
    // handle this situation
}
Posted by: Guest on January-20-2022

Browse Popular Code Answers by Language