note 100564 deleted from language.namespaces.faq by danbrown
| From: | danbrown@php.net | Date: | Sat, 23 Oct 2010 16:53:51 +0000 |
| Subject: | note 100564 deleted from language.namespaces.faq by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173400@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
There is an error in the Example #9 Dangers of using namespaced names inside a double-quoted string:
$a = new "dangerous\name"; // \n is a newline inside double quoted strings!
$obj = new $a;
$a = new 'not\at\all\dangerous'; // no problems here.
$obj = new $a;
the 'new' is not allowed just before a string, this throws a fatal error, the correct code
is:
$a = "dangerous\name"; // \n is a newline inside double quoted strings!
$obj = new $a;
$a = 'not\at\all\dangerous'; // no problems here.
$obj = new $a;