如何在PHP中生成一系列数字,增量为0.25(+6.00 at -15.00)?

时间:2016-04-20 22:17:12

标签: php grid

我需要生成一个网格(+6.00 at -15.00)!有人可以帮帮我吗? PHP代码请。

6.00 5.75 5.50 5.25 5.00 。 。 。 。 -15.00

1 个答案:

答案 0 :(得分:0)

“实际信用转到@Mark Ba​​ker”

但在这里,我只是把它放在一个良好的状态,这就是你如何做到这一点:

<?php
$grid = range(6, -15, 0.25);
echo "<pre>";
print_r($grid);
echo "</pre>";
?>

以下是代码的输出:

Array
(
    [0] => 6
    [1] => 5.75
    [2] => 5.5
    [3] => 5.25
    [4] => 5
    [5] => 4.75
    [6] => 4.5
    [7] => 4.25
    [8] => 4
    [9] => 3.75
    [10] => 3.5
    [11] => 3.25
    [12] => 3
    [13] => 2.75
    [14] => 2.5
    [15] => 2.25
    [16] => 2
    [17] => 1.75
    [18] => 1.5
    [19] => 1.25
    [20] => 1
    [21] => 0.75
    [22] => 0.5
    [23] => 0.25
    [24] => 0
    [25] => -0.25
    [26] => -0.5
    [27] => -0.75
    [28] => -1
    [29] => -1.25
    [30] => -1.5
    [31] => -1.75
    [32] => -2
    [33] => -2.25
    [34] => -2.5
    [35] => -2.75
    [36] => -3
    [37] => -3.25
    [38] => -3.5
    [39] => -3.75
    [40] => -4
    [41] => -4.25
    [42] => -4.5
    [43] => -4.75
    [44] => -5
    [45] => -5.25
    [46] => -5.5
    [47] => -5.75
    [48] => -6
    [49] => -6.25
    [50] => -6.5
    [51] => -6.75
    [52] => -7
    [53] => -7.25
    [54] => -7.5
    [55] => -7.75
    [56] => -8
    [57] => -8.25
    [58] => -8.5
    [59] => -8.75
    [60] => -9
    [61] => -9.25
    [62] => -9.5
    [63] => -9.75
    [64] => -10
    [65] => -10.25
    [66] => -10.5
    [67] => -10.75
    [68] => -11
    [69] => -11.25
    [70] => -11.5
    [71] => -11.75
    [72] => -12
    [73] => -12.25
    [74] => -12.5
    [75] => -12.75
    [76] => -13
    [77] => -13.25
    [78] => -13.5
    [79] => -13.75
    [80] => -14
    [81] => -14.25
    [82] => -14.5
    [83] => -14.75
    [84] => -15
)