PHP: Copy On Write and Assign By Reference perform different on PHP5 and PHP7

前端 未结 2 1823
迷失自我
迷失自我 2021-01-05 18:01

We have a piece of simple code:

1    

On PHP5, it outputs 8, because:

2条回答
  •  渐次进展
    2021-01-05 18:42

    I'd say the way it works in PHP7 is the right way. It's bad to implicitly change the way operators work depending whether operand is referenced anywhere or not.

    This is the best thing about PHP7 being completely rewritten: no clumsy/bug-driven-development v4/v5 code will work.

提交回复
热议问题