note 23574 added to language.types.string

From: Date: Tue, 23 Jul 2002 03:26:28 +0000
Subject: note 23574 added to language.types.string
Groups: php.notes 
Request: Send a blank email to php-notes+get-33399@lists.php.net to get a copy of this message
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! -- http://www.php.net/manual/en/language.types.string.php http://master.php.net/manage/user-notes.php?action=edit+23574 http://master.php.net/manage/user-notes.php?action=delete+23574 http://master.php.net/manage/user-notes.php?action=reject+23574

« previous php.notes (#33399) next »