3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total_pages = 100; $current_page = 50; $boundaries = 2; $around = 2; $arr1 = range(1, $boundaries); $arr2 = range($total_pages - max(($boundaries - 1), 0), $total_pages); $arr3 = range(min($current_page - $around, 1), $current_page); $arr4 = range($current_page, $current_page + $around); $result = array_unique(array_merge($arr1, $arr2, $arr3, $arr4)); sort($result); var_dump($arr3 ); ?>
Output for git.master, git.master_jit, rfc.property-hooks
array(50) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) [6]=> int(7) [7]=> int(8) [8]=> int(9) [9]=> int(10) [10]=> int(11) [11]=> int(12) [12]=> int(13) [13]=> int(14) [14]=> int(15) [15]=> int(16) [16]=> int(17) [17]=> int(18) [18]=> int(19) [19]=> int(20) [20]=> int(21) [21]=> int(22) [22]=> int(23) [23]=> int(24) [24]=> int(25) [25]=> int(26) [26]=> int(27) [27]=> int(28) [28]=> int(29) [29]=> int(30) [30]=> int(31) [31]=> int(32) [32]=> int(33) [33]=> int(34) [34]=> int(35) [35]=> int(36) [36]=> int(37) [37]=> int(38) [38]=> int(39) [39]=> int(40) [40]=> int(41) [41]=> int(42) [42]=> int(43) [43]=> int(44) [44]=> int(45) [45]=> int(46) [46]=> int(47) [47]=> int(48) [48]=> int(49) [49]=> int(50) }

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:
40.07 ms | 403 KiB | 8 Q