php escaping in single-quotes

just discovered this strange behaviour in php, quite irritating actually:

echo '\\.'."\n";
echo '\.'."\n";

output:

\.
\.

to get two backslashes while using single-quotes, you need to do the following

echo '\\\.'."\n";

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">