PHP switch statement variable scope

前端 未结 4 1333
耶瑟儿~
耶瑟儿~ 2021-01-03 00:51

In PHP, how is variable scope handled in switch statements?

For instance, take this hypothetical example:

$someVariable = 0;

switch($something) {

          


        
4条回答
  •  一个人的身影
    2021-01-03 01:38

    It will print 1 or 2 if you change the value of $someVariable in the switch statement, and 0 if you don't.

提交回复
热议问题