2 回答
TA贡献1803条经验 获得超6个赞
你可以使用 array_merge_recursive
$fromData=array('id' => '004','shapeid' => 'circle','x' =>'360','y' => '560', 'tooltext' => 'vivek','labelpos' => 'bottom');
$ToData=array('id' => '005','shapeid' => 'triangle','x' =>'480','y' => '980', 'tooltext' => 'kimi','labelpos' => 'top');
$newdata= array_merge_recursive($fromData,$ToData);
输出将是
Array
(
[id] => Array
(
[0] => 004
[1] => 005
)
[shapeid] => Array
(
[0] => circle
[1] => triangle
)
[x] => Array
(
[0] => 360
[1] => 480
)
[y] => Array
(
[0] => 560
[1] => 980
)
[tooltext] => Array
(
[0] => vivek
[1] => kimi
)
[labelpos] => Array
(
[0] => bottom
[1] => top
)
)
TA贡献1802条经验 获得超6个赞
这可以根据@Ajith 在上述评论中的建议来完成
$result[] = $fromData; $result[] = $ToData;
你可以在这里查看这个实现,https://3v4l.org/0QR56
- 2 回答
- 0 关注
- 264 浏览
添加回答
举报