Math - Adding with PHP
Basically I can't get it right.
I need something like this:
if($p == 1)
{
$start = 0;
$limit = 16;
}
The numbers must add on depending on the value of the $p, e.g. if $p is 5 then the values of $start and $limit would be:
if($p == 5)
{
$start = 64;
开发者_JAVA百科$limit = 80;
}
The math is to add 16, depending on the value of $p.
$start = ($p - 1) * 16;
$limit = $start + 16;
And don't forget to add a test for when $p < 1
$start = ($p - 1) * 16;
$limit = $p * 16;
精彩评论