PHP code example of pointdeb / zpaginate
1. Go to this page and download the library: Download pointdeb/zpaginate library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pointdeb / zpaginate example snippets
use Zpaginate\Zpaginate;
public function testPaginate()
{
// initialize data
$data = [];
for ($i = 0; $i < 10; $i ++ ) {
$data[] = ['name' => "Name $i"];
}
// set params
$current = 3;
$per_page = 5;
$per_link = 3;
$allow_over_max_page = false;
// execute paginate
$result = Zpaginate::paginate($data, $current, $per_page, $per_link, $allow_over_max_page);
// hope you'l see the output
print_r($result);
}