$a = &$b vs $a =& $b

Anyone who works with PHP probably knows what “assignment by reference” is.
This is an instruction like $a = &$b, which essentially means that the variable $a is a reference to the variable $b. That is, as a result:

the value 20 will be displayed, since $a simply references $b.

And such a record, in my opinion, looks logical. On the left is the variable to which we assign something, in the middle is the assignment operator “=”, on the right is what we assign – a reference to the variable $b, which, to show that this is a reference, is designated with &.

However, it turns out that there is a completely equivalent record of the same instruction, in the form:

$a =& $b;

It works completely equivalently. As a result, $a will still be a reference to $b.

But for me, such a notation is much less informative. I always get stupefied when I see the unfamiliar assignment operator “=&”, which, when written this way, is caught by the eye in the middle.

Apparently, someone finds such a notation more convenient. But what is its convenience?
I can’t understand.

0 0 votes
Article Rating
Subscribe
Notify of
0 Комментарий
Newest
Oldest Most Voted
Inline Feedbacks
View all comments