如何将每个元素分别放入已经在php

时间:2018-11-16 13:25:54

标签: php arrays associative-array

我有一些数据,基本上我想做的是将其中的每个元素分别放入数组中

array (size=4112)
  'new Date('2018-09-22 00:00:11')' => float 22.2148
  'new Date('2018-09-22 00:00:33')' => float 22.2154
  'new Date('2018-09-22 00:00:55')' => float 22.2094
  'new Date('2018-09-22 00:01:16')' => float 22.1987
  'new Date('2018-09-22 00:01:35')' => float 22.2005
  'new Date('2018-09-22 00:01:43')' => float 22.1914
  'new Date('2018-09-22 00:01:59')' => float 22.2025
  'new Date('2018-09-22 00:02:20')' => float 22.1882
  'new Date('2018-09-22 00:02:54')' => float 22.1864
           ....

我如何将每个'new Date('2018-09-22 00:00:11')'=>将22.2148浮动到php中的另一个数组中?

这是代码

foreach($unitTelemetryData1 as $device) {
    array_shift($device);//RemoveTimeSTAMP
    foreach($device as $key => $value)
    {
        //echo $key ." ".$value;
        $tempX = array_column($unitTelemetryData1,$key,$TimeStamp);
        array_push($result,$tempX);

    }
    break;
}

//var_dump($result);
//die();


foreach($result as $r)
{

    $result1 = array('series'=>array('name' => $serial, 'data' => $r));
    array_push($result2,$result1);
    //break;
}

查看最后一个foreach $ r确实包含键和值

0 个答案:

没有答案