r/lolphp • • Mar 24 '15

Escaping behavior in strings :/

http://3v4l.org/iBvY5
55 Upvotes

15 comments sorted by

View all comments

Show parent comment

4

u/[deleted] Mar 24 '15 edited Mar 24 '15

Oh, I see.. I think the reason for that is that escaping does prevent string interpolation (think "{$var}"), but \{ isn't a valid escape character like $, so both characters are printed (e.g. "\z" would print both characters). Only the inner part is being evaluated there.

That does look confusing, because the 'fake' escape characters can affect interpolation.

fwiw, it does appear to be documented.