This article mainly introduces the php array paging implementation method, involving php array operations, mathematical operations, string operations, and other related skills, for more information about how to implement php array paging, see the example in this article. We will share this with you for your reference. The details are as follows:
<? Php $ arr_click = array ('clicks' => 3, 'clickdate' => '2017-10-11 '), array ('clicks' => 2, 'clickdate' => '2017-10-10 '), array ('clicks' => 3, 'clickdate' => '2017-10-09 '), array ('clicks' => 4, 'clickdate' => '2017-10-08 '), array ('clicks' => 5, 'clickdate' => '2017-10-13 '), array ('clicks' => 7, 'clickdate' => '2017-10-14 '), array ('clicks' => 6, 'clickdate' => '2017-10-15 '), array ('clicks' => 9, 'Clickdate' => '2017-10-16 '),); if (! Isset ($ _ GET ['Page']) {$ page = 1 ;}else {$ page =$ _ GET ['Page'] ;}$ size = 3; // number of records displayed per page $ pnum = ceil (count ($ arr_click)/$ size); // total number of pages, ceil () the function is used to evaluate the smallest integer greater than the number. // use the array_slice (array, offset, length) function to retrieve a value in the array according to the conditions. array (array ), offset (starting position of the element), length (group length) $ newarr = array_slice ($ arr_click, ($ page-1) * $ size, $ size ); for ($ I = 0; $ I
";}?> <? Phpif (! Isset ($ _ GET ['Page']) | $ _ GET ['Page'] <= 1) {?> <? Php} else {?> "> Next page <? Php }?>