mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/IZYIM-Manufacturer.git
synced 2026-08-19 04:13:56 +00:00
17 lines
471 B
PHP
17 lines
471 B
PHP
<?php
|
|
function paging($input, $page, $show_per_page) {
|
|
$start = $page;
|
|
$end = $start + $show_per_page;
|
|
$count = count($input);
|
|
|
|
// Conditionally return results
|
|
if ($start < 0 || $count <= $start)
|
|
// Page is out of range
|
|
return array();
|
|
else if ($count <= $end)
|
|
// Partially-filled page
|
|
return array_slice($input, $start);
|
|
else
|
|
// Full page
|
|
return array_slice($input, $start, $end - $start);
|
|
} |