Are multiple variable assignments done by value or reference?

后端 未结 7 2125
天命终不由人
天命终不由人 2020-12-10 00:33
$a = $b = 0;

In the above code, are both $a and $b assigned the value of 0, or is $a just refer

相关标签:
7条回答
  • 2020-12-10 01:21

    You could have tried it yourself

    $a = $b = 0;
    $a = 5;
    echo $b;
    

    or

    $a = $b = 0;
    $b = 5;
    echo $a;
    

    (currently I dont really care :D)

    Thus: No, they are both independent variables with the value 0.

    0 讨论(0)
提交回复
热议问题