我有一个样本数组。我想合并为单行作为标题,并将值添加到下面的相应标题中。我已经尝试过,但是我的运气不好。在下面,我共享示例数组。
( [0] => Array( [sno] => 1, [datetime] => 2019-06-23 12:00:05, [dkey] => EMIUnit1P575011 2659, [ID1 Rotary GearBox Line to neutral voltage VLN] => 242, [ID1 Rotary GearBox Current average A] => 0, [ID1 Rotary GearBox Active power total W] => 524 ) [1] => Array( [sno] => 2, [datetime] => 2019-06-23 11:45:04, [dkey] => EMIUnit1P575011 2658, [ID1 Rotary GearBox Line to neutral voltage VLN] => 241, [ID1 Rotary GearBox Current average A] => 7, [ID1 Rotary GearBox Active power total W] => 2546 ) [2] => Array( [sno] => 3, [datetime] => 2019-06-23 11:30:04, [dkey] => EMIUnit1P575011 2657, [ID1 Rotary GearBox Line to neutral voltage VLN] => 241, [ID1 Rotary GearBox Current average A] => 22, [ID1 Rotary GearBox Active power total W] => 2475 ) [3] => Array( [sno] => 1 [datetime] => 2019-06-23 12:00:26, [dkey] => D0B5C2C17EAF_B2.0 2, [voltage] => 232 [Amps] => 2, [Power] => 296 ) [4] =>Array ( [sno] => 2, [datetime] => 2019-06-23 11:45:25, [dkey] => D0B5C2C17EAF_B2.0 1, [voltage] => 232, [Amps] => 0, [Power] => 200 ) )
我已经尝试过,但是我不确定逻辑。请帮助我实现这一目标。 预期的数组如下所示
(
[0] => Array
(
[sno] => 1
[datetime] => 2019-06-23 12:00:05
[dkey] => EMIUnit1P575011 2659
[ID1 Rotary GearBox Line to neutral voltage VLN] => 242
[ID1 Rotary GearBox Current average A] => 0
[ID1 Rotary GearBox Active power total W] => 524
[voltage] => 232
[Amps] => 2
[Power] => 296
)
[1] => Array
(
[sno] => 2
[datetime] => 2019-06-23 11:45:04
[dkey] => EMIUnit1P575011 2658
[ID1 Rotary GearBox Line to neutral voltage VLN] => 241
[ID1 Rotary GearBox Current average A] => 7
[ID1 Rotary GearBox Active power total W] => 2546
[voltage] => 232
[Amps] => 0
[Power] => 200
)
[2] => Array
(
[sno] => 3
[datetime] => 2019-06-23 11:30:04
[dkey] => EMIUnit1P575011 2657
[ID1 Rotary GearBox Line to neutral voltage VLN] => 241
[ID1 Rotary GearBox Current average A] => 22
[ID1 Rotary GearBox Active power total W] => 2475
)
)