note 76149 added to language.types.string
| From: | php at modem-help dot com | Date: | Tue, 03 Jul 2007 03:32:21 +0000 |
| Subject: | note 76149 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128168@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 194.145.210.3
Probable Submitter: 84.9.191.72
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- https://master.php.net/note/edit/76149
Del: integrated -- https://master.php.net/note/delete/76149/integrated
Del: useless -- https://master.php.net/note/delete/76149/useless
Del: bad code -- https://master.php.net/note/delete/76149/bad+code
Del: spam -- https://master.php.net/note/delete/76149/spam
Del: non-english -- https://master.php.net/note/delete/76149/non-english
Del: in docs -- https://master.php.net/note/delete/76149/in+docs
Del: other reasons-- https://master.php.net/note/delete/76149
Reject -- https://master.php.net/note/reject/76149
Search -- https://master.php.net/manage/user-notes.php