php variable scope

后端 未结 6 2007
栀梦
栀梦 2020-12-01 19:31

i\'m confused about the php variable scope. such as:

while(true){
    $var = \"yes , it is a test!\";
  }
  printf($var)

the $var

6条回答
  •  一生所求
    2020-12-01 20:13

    In PHP, a while loop doesn't create a new scope. So it will be available in the function

提交回复
热议问题