note 86420 modified in language.namespaces.basics by bjori
| From: | bjori@php.net | Date: | Tue, 23 Jun 2009 09:12:57 +0000 |
| Subject: | note 86420 modified in language.namespaces.basics by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157259@lists.php.net to get a copy of this message | ||
PHP 5.3.0alpha2 (cli)
<?php
// namespace MyProject\DB;
require 'db.php';
use MyProject\DB; // fine; same as DB\
use MyProject\DB\Connection as DBC; // fine
use MyProject\DB as HM; // fine
use HM\Connection as DBC2; // class call ends with FATAL!!!
$x = new DBC(); // fine
$y = new HM\Connection(); // fine
$z = new DBC2(); // Fatal error: Class 'HM\Connection' not found
?>
--was--
PHP 5.3.0alpha2 (cli)
<?php
// namespace MyProject::DB;
require 'db.php';
use MyProject::DB; // fine; same as DB::
use MyProject::DB::Connection as DBC; // fine
use MyProject::DB as HM; // fine
use HM::Connection as DBC2; // class call ends with FATAL!!!
$x = new DBC(); // fine
$y = new HM::Connection(); // fine
$z = new DBC2(); // Fatal error: Class 'HM::Connection' not found
?>
http://php.net/manual/en/language.namespaces.basics.php