Skip to content

Instantly share code, notes, and snippets.

@ramigb
Last active December 30, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramigb/7854548 to your computer and use it in GitHub Desktop.
Save ramigb/7854548 to your computer and use it in GitHub Desktop.
Pagination - Get limit and offset
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