note 117334 deleted from language.namespaces.importing by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 11:02:32 +0000 |
| Subject: | note 117334 deleted from language.namespaces.importing by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210861@lists.php.net to get a copy of this message | ||
Note Submitter: sernuzh at gmail dot com
----
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();
}
?>