note 76149 deleted from language.types.string by felipe

From: Date: Sun, 23 Mar 2008 23:16:11 +0000
Subject: note 76149 deleted from language.types.string by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137443@lists.php.net to get a copy of this message
Note Submitter: php at modem-help dot com ---- The section `#language.types.string.parsing' above says: "Before PHP 5.1.1, backslash in \{$var} hasn't been printed." ...but does not inform how to fix that. The answer is easy: double each curly-bracket. So, when producing inline CSS: <?php $hBack = '#99ccff'; $hFore = '#000088'; $style = "background:$hBack;color:$hFore;" echo "h1 {background:$hBack;color:$hFore;} h2 \{$style} h3 {{$style}}"; ?> PHP < v5.1.1 prints: h1 {background:#99ccff;color:#000088;} h2 {background:#99ccff;color:#000088;} h3 {background:#99ccff;color:#000088;} PHP => v5.1.1 prints: h1 {background:#99ccff;color:#000088;} h2 \{background:#99ccff;color:#000088;} h3 {background:#99ccff;color:#000088;} Please note: I have not checked `{{$style}}' on PHP before v5.1.1; the assumption seems reasonable.

« previous php.notes (#137443) next »