Hi,
I got this long version code:
if(ISSET($_GET['limit']))
{
$limit = intval($_GET['limit']);
}
else
{
$limit = intval(1);
}
I can shorten it, like this and it works:
$limit = ISSET($_GET['limit'])?intval($_GET['limit']):1;
Now add an echo and try shortening it. And I get error.
I got this long code with echo in it:
if(ISSET($_GET['limit']))
{
$limit = intval($_GET['limit']);
echo "<option value=\"$limit\">$limit</option>";
}
else
{
$limit = intval(1);
}
Now, how do I shorten it ?
These 2 fail! Show error:
1
$limit = ISSET($_GET['limit'])?intval($_GET['limit']);echo "<option value=\"$limit\">$limit</option>";:1;
2
$limit = (ISSET($_GET['limit'])?intval($_GET['limit']);echo "<option value=\"$limit\">$limit</option>";:1)