3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Prepare current, total pages and pagination container $current = isset($_GET['page']) ? intval($_GET['page']) : 1; $total = 5; $pagination = []; // Check if pagination required if ($total > 1) { // Check if current page is not first page if ($current > 1) { $pagination[] = '<a class="pagination_backward" href="#">قبلی</a>'; $pagination[] = '<span style="color:#848d95; margin:0px 10px;">…</span>'; } // Iterate through pages for ($i = 1; $i <= $total; $i++) { // Check if handling current page if ($i === $current) { $pagination[] = '<a class="pagination_active" href="#">' . $i . '</a>'; } else { $pagination[] = '<a href="#">' . $i . '</a>'; } } // Check if current page is not last page if ($current < $total) { $pagination[] = '<span style="color:#848d95; margin:0px 10px;">…</span>'; $pagination[] = '<a class="pagination_backward" href="#">بعدی</a>'; } } var_dump($pagination);
Output for git.master, git.master_jit, rfc.property-hooks
array(7) { [0]=> string(43) "<a class="pagination_active" href="#">1</a>" [1]=> string(17) "<a href="#">2</a>" [2]=> string(17) "<a href="#">3</a>" [3]=> string(17) "<a href="#">4</a>" [4]=> string(17) "<a href="#">5</a>" [5]=> string(56) "<span style="color:#848d95; margin:0px 10px;">…</span>" [6]=> string(52) "<a class="pagination_backward" href="#">بعدی</a>" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.92 ms | 1682 KiB | 4 Q