Last active
December 30, 2015 16:28
-
-
Save ramigb/7854548 to your computer and use it in GitHub Desktop.
Pagination - Get limit and offset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function page($page,$limit){ | |
if($page == 0 ){ | |
return 0; | |
}elseif ($page == 1){ | |
return $limit; | |
}else{ | |
if($limit == 1){ | |
return $page * $limit; | |
}else{ | |
return ($page * $limit) - $limit; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment