我正在尝试打印一个数组,其中所有其他值都被重新分配,例如(来自this):
17.34502870451717,62.46137370987033
对此:
62.46137370987033,17.34502870451717
那部分我已经成功了,但现在我有了这个结构:
[62.46137370987033,[17.34501402936927,]
[62.46123453616544,[17.34525377433593,]
[62.4610178881864,[17.34546663705899,]
这就是我卡住了,不知道怎么写的地方。
我想要的结构如下所示:
[62.392628, 17.309413],
[62.393162, 17.309193],
[62.393403, 17.30922]
这是我的explode.php(GIST)
<?php
$dwarf = "17.34502870451717,62.46137370987033,17.34501402936927,62.46123453616544";
$minion = explode(",",$dwarf);
$wing = "[";
for ($i = 0;$i < count($minion) -1; $i++) {
echo $wing . $minion[$i+1].",";
if($i%2==1) { echo "]<br />"; }
} echo $minion[0] . $wing;
?>