note 117334 added to language.namespaces.importing
| From: | sernuzh at gmail dot com | Date: | Sat, 23 May 2015 07:18:49 +0000 |
| Subject: | note 117334 added to language.namespaces.importing | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202645@lists.php.net to get a copy of this message | ||
You'll get here the
Fatal error: Cannot declare class others\name because the name is already in use
So you can't get two classes <name> inside one namespace
<?php
namespace my {
class name {
public function __construct(){
echo 'my_namespace_object';
}
}
}
namespace others{
use my\name;
class name {
public function __construct(){
echo 'others_namespace_object';
}
}
$newObject = new name();
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 46.201.100.109
----
Manual Page -- http://php.net/manual/en/language.namespaces.importing.php
Edit -- https://master.php.net/note/edit/117334
Del: integrated -- https://master.php.net/note/delete/117334/integrated
Del: useless -- https://master.php.net/note/delete/117334/useless
Del: bad code -- https://master.php.net/note/delete/117334/bad+code
Del: spam -- https://master.php.net/note/delete/117334/spam
Del: non-english -- https://master.php.net/note/delete/117334/non-english
Del: in docs -- https://master.php.net/note/delete/117334/in+docs
Del: other reasons-- https://master.php.net/note/delete/117334
Reject -- https://master.php.net/note/reject/117334
Search -- https://master.php.net/manage/user-notes.php