我的代码类似于;
function myFunc() {
$myArry = array();
$myArry[1]['first'] = "First";
$myArry[1]['second'] = "Second";
$myArry[2]['first'] = "First";
$myArry[2]['second'] = "Second";
$myArry[3]['first'] = "First";
$myArry[3]['second'] = "Second";
echo "before return: ".count($myArry);
return $myArry;
}
// main code
$returnedArry = array(myFunc());
echo "after return: ".count($returnedArry);
输出:
before return: 3
after return: 1
这里发生了什么,有人可以解释一下吗?还有,我该怎么办?
谢谢你。