I think there a easier way to perform the same function but without if statements.
if (isset($_GET['limit']))
{
$limit = $_GET['limit'];
}
else
{
$limit = 10;
}
If there is I'd be open to hearing it...
...But I think your best bet is just a short hand if/else statement instead. Not that it really makes any difference.
$limit = (isset($_GET['limit']) ? $_GET['limit'] : 10;
More info here - http://www.lizjamieson.co.uk/9/short-if-statement-in-php/
short if ?
$limit = isset($_GET['limit']) ? $_GET['limit'] : 10;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With