Create an array/collection/list of (Date,Value) in PHP

前端 未结 3 1571
我在风中等你
我在风中等你 2021-01-26 12:50

I am writing a PHP script where the inputs are:

From date
To date

I then want to take that date range and create an array of some sort that has

3条回答
  •  时光取名叫无心
    2021-01-26 13:09

    If I understand you correctly, you could use an associative array for that:

    array(
      '00-00-00' => $value,
      '01-01-01' => $value,
      // etc...
    );
    

    Or you can create it like this:

    $myArray = array();
    $myArray['00-00-00'] = $value;
    $myArray['01-01-01'] = $value;
    

    You could populate them by running a loop...

提交回复
热议问题