note 23574 deleted from language.types.string by danbrown

From: Date: Tue, 17 May 2011 14:21:50 +0000
Subject: note 23574 deleted from language.types.string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179805@lists.php.net to get a copy of this message
Note Submitter: guidod at gmx dot de ---- PHP's double-quoted strings are inherently ill-featured - they will be a problem especially with computed code like in /e-evals with preg_replace. bash and perl follow the widely accepted rule that all backslashes will escape the nextfollowing char, and nonalpha-chars will always get printed there as themselves whereas (the unescaped chars might have special meaning in regex). Anyway, it is a great way to just escape all nonalpha chars that you uncertain about whether they have special meaning in some places, and ye'll be sure they will get printed literal. Furthermore, note that \{ sequence is not mentioned in the escape-char table! You'll get to know about it only "complex (curly) syntax". This can even more be a problem with evals, as they behave rather flaky like it _cannot_ be accomodated for computed code. Try all variants of echo "hello \{\$world}" removing one or more of the chars in the \{\$ part - have fun!

« previous php.notes (#179805) next »