I was writing the script to display the social share counters of various API's and while running the PHP file it gives a Parse error: syntax error, unexpected T_FUNCTION. I know it's an older PHP version issue, as mine is 5.2.17 but I need suggestions to overcome this thing. Here's the code:
// Facebook
array(
'name' => 'facebook',
'method' => 'GET',
'url' => 'https://graph.facebook.com/fql?q=' . urlencode("SELECT like_count, total_count, share_count, click_count, comment_count FROM link_stat WHERE url = \"{$url}\""),
'callback' => function($resp) {
if(isset($resp->data[0]->total_count)) {
return (int)$resp->data[0]->total_count;
} else {
return 0;
}
})