PHP Developers Cookbook (2nd Edition)

"{$" Is Not Supported in Strings

The "{$" combination is not allowed in strings. To place the "{$" combination in strings, you must escape it like this: "\ {$" .

Valid in PHP 3

<?php $foo = "Windows"; print str_replace ("{$foo} ", "Linux", "This {Windows} rules."); ?>

Valid in PHP 4

<?php $foo = "Windows"; print str_replace ("\{$foo} ", "Linux", "This {Windows} rules."); ?>

Категории