在php中使用foreach()内的try()

i am try to use try() inside foreach in php for facebook application my app get user permissions than post on his 3 friends wall but the problem is that if one of user friends is non-postable than my app stop with error below is my code and error please take a look

        foreach ($friends_list_array["data"] as $value) {
                                                        try
                                                                {
         // compile the post for for user
        $WallPost = array(
        'access_token' => $atoken,
            'message' => $value["name"] . ' .. message here  ',
            'link' => 'link_here');  


        // post to user wall
        $response = $facebook->api('/' . $value["id"] . '/feed','POST',$WallPost);


        echo ' posted on ' . $value["name"];

                                                                    }
    }

all works fine(except non-postable wall problem) without try() its shows error below is error

Parse error: syntax error, unexpected '}', expecting T_CATCH in

Can any one please solve this thank you

Look here

Each try must have at least one corresponding catch block

And thats the answer to your problem ( the error itself says about it, expecting T_CATCH)

If you do not need catch, just don't fill it with any logic, working example:

foreach ($friends_list_array["data"] as $value) {
 try{
  // do stuff...
 }
 catch(Exception $e){
  // do nothing
 }
}