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.

Ruby on Rails: image_submit_tag and :confirm

I was told about an issue today with the image_submit_tag not supporting the :confirm method on the element:

so I thought I’d share a quick fix which would be the actual javascript returned by the function:

Hope this can save some people time…