PHP array Paging implementation method, PHP array paging
This article describes the PHP array paging implementation method. Share to everyone for your reference, as follows:
<?php$arr_click = Array (' clicks ' = 3, ' clickdate ' = ' 2010-10-11 '), Array (' clicks ' = = 2, ' clickdate ' = > ' 2010-10-10 '), Array (' clicks ' = 3, ' clickdate ' = ' 2010-10-09 '), Array (' clicks ' = 4, ' clickdate ' = ' 201 0-10-08 '), Array (' clicks ' = 5, ' clickdate ' = ' 2010-10-13 '), Array (' clicks ' = 7, ' clickdate ' = ' 2010-10-14 ') ), array (' clicks ' = 6, ' clickdate ' = ' 2010-10-15 '), Array (' clicks ' = = 9, ' clickdate ' = ' 2010-10-16 '),); if ( !isset ($_get[' page ')) {$page = 1;} else{$page =$_get[' page ';} $size =3;//The number of records displayed per page $pnum = ceil (count ($arr _click)/$size); Total pages, the Ceil () function is used to find the smallest integer greater than the number//using the Array_slice (array,offset,length) function to take a certain value out of the array according to the criteria; Array (array), offset (the starting position of the element), Length ( The length of the group) $newarr = Array_slice ($arr _click, ($page-1) * $size, $size); for ($i =0; $i
";}? ><?phpif (!isset ($_get[' page ')) | | $_get[' page ']<=1) {?> prev <?php}else{?> "> Previous <?php}?> <?php if ($_get[' page ']>= $pnum) {?> "> Next <?php}else{?>" > Next <?php}?>
More about PHP related content readers can view the topic: "PHP array" operation Skills Daquan, "PHP Math Skills Summary", "PHP Regular Expression Usage Summary", "Php+ajax Tips and Applications Summary", "PHP operation and operator Usage Summary", " PHP Network Programming Skills Summary, PHP Basic Grammar Introductory tutorial, PHP date and Time usage summary, PHP Object-oriented Programming primer tutorial, PHP string Usage Summary, PHP+MYSQL Database Operations primer, and A summary of common PHP database operation techniques
I hope this article is helpful to you in PHP programming.
http://www.bkjia.com/PHPjc/1125252.html www.bkjia.com true http://www.bkjia.com/PHPjc/1125252.html techarticle PHP Array Paging implementation method, PHP array Paging This article describes the PHP array paging implementation method. Share to everyone for your reference, as follows: Php$arr_click = Array (' Clic ...