这是我的代码:
$products = array(
array ("08:10", "10:30", "13:15"),
array ("GSÖ2B2U", "VSH2B2U", "FOR2B2U"),
array ("GUS", "GJG", "GRL")
);
我希望能够通过这个循环并接收以下输出:
08:10 GSÖ2B2U GUS
10:30 VSH2B2U GJG
13:15 FOR2B2U GRL
我试着寻找答案,但我似乎找不到任何,帮助感激:)
你可以试试-
$products = array(
array ("08:10", "10:30", "13:15"),
array ("GSÖ2B2U", "VSH2B2U", "FOR2B2U"),
array ("GUS", "GJG", "GRL")
);
$new= array();
for ($i = 0; $i < count($products); $i++) {
$new[] = array_column($products, $i);
}
foreach($new as $vals) {
echo implode(' ', $vals) . '<br>';
}
08:10 GSÖ2B2U GUS<br>
10:30 VSH2B2U GJG<br>
13:15 FOR2B2U GRL<br>