#1 coolcool1265
function index(){
$this->stack = array("orange", "banana", "apple", "raspberry");
dump($this->stack);
$fruit = array_pop($this->stack);
dump($this->stack); //$this->stack的值和原来一样,并没有改变。
}
如果把上面的变量不用$this->stack,而用$stack结果是正确的。这是为什么?数组函数对它无效么?
PS:我试过了用临时变量
下面的结果是正确的。
function index(){
$a= array("orange", "banana", "apple", "raspberry");
dump($a);
$fruit = array_pop($a);
$this->stack=$a;
dump($this->stack);
}
2011-03-13 15:26:03