PHP Pass by reference error after using same var

前端 未结 3 823
暖寄归人
暖寄归人 2021-01-15 01:40

Take a look to this code, and help me to understand the result

$x = array(\'hello\', \'beautiful\', \'world\');
$y = array(\'bye bye\',\'world\', \'harsh\');         


        
3条回答
  •  长情又很酷
    2021-01-15 02:32

    Foreach loops are not functions.An ampersand(&) at foreach does not work to preserve the values like at functions. So even if you have $var in the second foreach () do not expect it to be like a "ghost" out of the loop.

提交回复
热议问题