我有一个数组代码,例如:
$responeArray = array();
$_counter = 0;
foreach ($xmlResp->readCalls->classify as $readCalls) {
$ClassificationClass = array();
foreach ($readCalls->classification->{'class'} as $classes) {
$ClassificationClass[] = implode(" ", array('p' => (string)$classes['p']));
}
$responeArray[] = $ClassificationClass;
$_counter++;
}
return $responeArray;
这将给出类似的结果
Array
(
[0] => Array
(
[0] => 0.999999
[1] => 5.65423e-007
[2] => 2.3301e-008
)
[1] => Array
(
[0] => 0.333333
[1] => 0.333333
[2] => 0.333333
)
[2] => Array
(
[0] => 1.19172e-007
[1] => 0.999993
[2] => 6.75659e-006
)
)
我的目的是得到类似的结果
0.999999 5.65423e-007 2.3301e-008
...
1.19172e-007 0.999993 6.75659e-006
我试过用这个
$responeArray = array();
$_counter = 0;
foreach ($xmlResp->readCalls->classify as $readCalls) {
$ClassificationClass = array();
foreach ($readCalls->classification->{'class'} as $classes) {
$ClassificationClass[] = implode(" ", array('p' => (string)$classes['p']));
}
$responeArray[] = $ClassificationClass;
$nilaineg = $ClassificationClass[0];
$nilainet = $ClassificationClass[1];
$nilaipos = $ClassificationClass[2];
$_counter++;
}
return $nilaineg . ' ' . $nilainet . ' ' . $nilaipos;
但上面的代码只是输出:
1.19172e-007 0.999993 6.75659e-006
我错过了什么吗?