note 118961 deleted from language.namespaces.definitionmultiple by cmb
| From: | cmb@php.net | Date: | Tue, 08 Mar 2016 08:21:25 +0000 |
| Subject: | note 118961 deleted from language.namespaces.definitionmultiple by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205116@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Notice it's not allowed to mix bracketed namespace with unbracketed namespace declarations.
<?php
namespace MyTest;
const TEST = 777;
//in this way
echo \MyTest\TEST . '<br />';
//Or this way
echo TEST . '<br />';
namespace AnotherTest {
const TEST = 555;
echo \AnotherTest\TEST . '<br />';
echo \MyTest\TEST;
}
?>
This code will issue a fatal error, like this: Fatal error: Cannot mix bracketed namespace
declarations with unbracketed namespace declarations in C:\xampp\htdocs\teste2.php on line 11.