Home  >  Q&A  >  body text

如果不小心将两个变量名设成一样的会发生什么后果

小水滴小水滴2833 days ago1305

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-09-30 23:06:31

    What will happen if you accidentally set the names of two variables to be the same - PHP Chinese website Q&A - What will happen if you accidentally set the names of two variables to be the same - PHP Chinese website Q&A

    Take a look around, Study it.

    reply
    0
  • 哈哈哈

    哈哈哈2016-12-20 13:40:31

    两个变量名一样的话,会覆盖掉一个变量,下面的变量会将上面的变量覆盖掉,就像下面这样

    $x=5;
    $x=10;

    这两个变量名是一样的,但是只有$x=10;才会有用,你如果输出$x,那么结果一定是10;

    记住,相同的变量名会被覆盖


    reply
    0
  • Cancelreply