Fatal Error stops execution in PHP-Collection of common programming errors
I have following code in PHP
foreach($arr as $u){
//code runs for users
$u->fetchFriends();
}
function fetchFriends(){
$sparam = array('method' => 'fql.query',
'query' => $fql,
'callback' => '',
'access_token' => $fbtoken);
try{
$fqlResult = $facebook -> api($sparam);
}
catch(Exception $e) {
echo 'There is issue with Token';
}
}
The problem is that if the FB API throws an exception, then the process stops and next users in foreach loop doesn’t get executed. I want that even if it throws an error, the foreach loop should run for all users. Is that possible?