PHP: variable not working inside of function?

后端 未结 5 896
滥情空心
滥情空心 2020-11-27 23:03
echo $path; //working
function createList($retval) {
    echo $path; //not working
    print \"
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 23:25

    Cause $path inside createList() and outside it (in global scope) are two different variables. Read more about variable scope in PHP.

提交回复
热议问题