我在外面有一个数组:
$myArr = array();
我想让我的函数访问其外部的数组,以便它可以向其中添加值
function someFuntion(){
$myVal = //some processing here to determine value of $myVal
$myArr[] = $myVal;
}
如何为函数赋予变量正确的作用域?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号