Home  >  Article  >  Backend Development  >  亲们,请问一个数组的小菜有关问题

亲们,请问一个数组的小菜有关问题

WBOY
WBOYOriginal
2016-06-13 13:28:58802browse

亲们,请教一个数组的小菜问题
注:$t[1],$t[2],$t[3]分别是不固定的多维数组(即$t[1]可能是二维,$t[2]是三维)。

$a = $t[1];
$b = $t[2];
$c = $t[3];

foo(array($a,$b,$c));

我想把三个数组用一个变量做为参数传入,请问要怎么写。

比如:
$sum = $a.$b.$c;
foo(array($sum));

字符串可以以上面的方面,数组要怎样写呢。

------解决方案--------------------

PHP code
$param = array();
$param[] = $a;
$param[] = $b;
$param[] = $c;
foo($param){
    echo $param[0];
    echo $param[1];
    echo $param[2];
}
<br><font color="#e78608">------解决方案--------------------</font><br>
PHP code

$result = array_merge($array1, $array2);
function foo($result){
  $array1 = $result[0];
  $array2 = $result[1];
}
<br><font color="#e78608">------解决方案--------------------</font><br>
PHP code
call_user_func_array('foo',array($a,$b,$c)); <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn