-1

我有这样的数组:

//Find the column
if($second_z==0.00){
  $valueColumn = $zero_list;
} else if($second_z==0.01){
  $valueColumn = $one_list;
} else if($second_z==0.02){
  $valueColumn = $two_list;
} else if($second_z==0.03){
  $valueColumn = $three_list;
} else if($second_z==0.04){
  $valueColumn = $four_list;
} else if($second_z==0.05){
  $valueColumn = $five_list;
} else if($second_z==0.06){
  $valueColumn = $six_list;
} else if($second_z==0.07){
  $valueColumn = $seven_list;
} else if($second_z==0.08){
  $valueColumn = $eight_list;
} else if($second_z==0.09){
  $valueColumn = $nine_list;
} else {}

和所有这些数组,我想插入数组:

$valueColumn_list[] = $valueColumn;

//I want the result if printing this array
$valueColumn_list = array($zero_list,$one_list,...);

但它说错误 - >不能将标量值用作数组

所以有人有解决方案吗?

谢谢。

4

2 回答 2

3

在黑暗中拍摄:$valueColumn_list = array("zero_list" => $zero_list, "one_list" => $one_list,...);

于 2013-06-29T07:49:46.567 回答
0

你可以通过以下方式做到这一点..

valueColumn_list = array();

if($second_z==0.00)
{
  valueColumn_list['zero_list'] = $zero_list;    //if $zero_list is array
}
else if($second_z==0.01)
{
  valueColumn_list['one_list'] = $one_list;
} 
else if($second_z==0.02)
{
   valueColumn_list['two_list']= $two_list;
}
.
.
.
于 2013-06-29T07:53:53.870 回答