[ create a new paste ] login | about

Link: http://codepad.org/Yd8VWUZU    [ raw code | output | fork ]

PHP, pasted on Nov 2:
1
2
3
4
5
6
7
8
9
10
<?php

$pages = array_keys(range(1, 115, 10));

$current = 5;
$threshold = 3;

print_r(array_slice($pages, $current - $threshold, $threshold * 2 + 1));

?>


Output:
1
2
3
4
5
6
7
8
9
10
Array
(
    [0] => 2
    [1] => 3
    [2] => 4
    [3] => 5
    [4] => 6
    [5] => 7
    [6] => 8
)


Create a new paste based on this one


Comments: