PHP syntex confusion
Posted: Fri Sep 19, 2014 12:04 am
Hey guys , My names gautam . and i recently started learning PHP because i had to build a small app in Php using the facebook graph API . below is a code snippet that communicates with the fb api to get a list of friends .
can somebody explain to me this line in the code .
Code: Select all
<?php
require_once('config.php');
$offset = ($_GET['offset'])?$_GET['offset']:0;
$limit = 100;
$friends = $facebook->api('/me/friends?offset=' .
$offset . '&limit=' . $limit);
print_r($friends);
if($friends['paging']['previous']) {
echo '<br><a target="_top" href="http://apps.facebook.com/
[your_application_url]/action_paging.php?offset=' .
($offset-$limit) . '">Previous</a>';
}
if($friends['paging']['next']) {
echo ' <a target="_top" href="http://apps.facebook.com/
[your_application_url]/action_paging.php?offset=
'.($offset+$limit).'">Next</a>';
}
?>
can somebody explain to me this line in the code .
Code: Select all
$offset = ($_GET['offset'])?$_GET['offset']:0;