PHP Array Paging Implementation method

Source: Internet
Author: User
Tags php database php programming php regular expression
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.

The above describes the PHP array paging implementation, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.