String Variable Concatenation

I stumbled across something odd today in PHP:

Now, personally, I’d have expected a syntax error from the above code, but the result was even more confusing at first…

Not sure if this was the expected output or not I tested similar code in other languages:

Ruby:

Python:

Javascript:

Perl:

That explains it!

So the reason the string is ‘aaaa’ seems to be that the code is evaluated from right to left:

I don’t think it’s a bug, well, at least I assume not, but is there a name for this?

Update: I asked some clever people for help understanding it.