Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #catch #object
ADD COMMENT
Topic
Name
8+6 =