php for循环建数据


      $data = [];
      for($i=0; $i<10; $i++) {
        $data[] = $i;
      }
      print_r($data);

执行后打印的结果为:

Array
(
    [0] => 0
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 4
    [5] => 5
    [6] => 6
    [7] => 7
    [8] => 8
    [9] => 9
)
原文地址:https://www.cnblogs.com/pinganzi/p/6172230.html