I'm trying to plot an array, but if one date is NULL, the value go to 1/1/1970.
I have the code:
$date1 = $row['date_initial'];
$date2 = $row['date_end'];
$value = $row['value'];
$data1 = array(strtotime($date1)*1000,$value);
$data2 = array(strtotime($date2)*1000,$value);
$data8[] = array($data1,$data2);
echo json_encode($data8);
I get this array:
[[[1456531200000,"-12"],[1456704000000,"-12"]],[[1456531200000,"-16"],[0,"-16"]],[[1456617600000,"-13"],[1456790400000,"-13"]],[[1456704000000,"-14"],[0,"-14"]]]
It would be possible to change the null value date and to put the current date until the date is not empty? or remove this pair of array?
I proved:
$data8 = array_map('array_filter', $data8);
$data8 = array_filter($data8);
but it doesn't work in this case...