PHP - Get Number of Pages

page-numbering, pagination, php

Solution

Try ceil() function.

$pages = ceil( $items / $itemsPerPage );

Problem

How do I get the number of pages if I know the total number of items there are and how many items are shown on each page? For example, I know that I have 11 items and each page shows 10 items. So I would have 2 pages. How would I get the number of pages in PHP? Thanks

Original source