note 119306 added to language.namespaces
| From: | Anonymous | Date: | Tue, 10 May 2016 08:15:09 +0000 |
| Subject: | note 119306 added to language.namespaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205450@lists.php.net to get a copy of this message | ||
Tested on PHP 7.0.5, Windows
The line "use animate;" equals the line "use animate as animate;"
but the "use other\animate;" equals "use other\animate as animate;"
file1:
<?php namespace foo;
class Cat {
static function says() {echo 'meoow';} } ?>
file2:
<?php namespace bar;
class Dog {
static function says() {echo 'ruff';} } ?>
file3:
<?php namespace other\animate;
class Animal {
static function breathes() {echo 'air';} } ?>
file4:
<?php namespace fub;
include 'file1.php';
include 'file2.php';
include 'file3.php';
use foo as feline;
use bar as canine;
use other\animate; //use other\animate as animate;
echo feline\Cat::says(), "<br />\n";
echo canine\Dog::says(), "<br />\n";
echo \animate\Animal::breathes(), "<br />\n"; ?>
----
Server IP: 72.52.91.14
Probable Submitter: 223.145.129.125
----
Manual Page -- http://php.net/manual/en/language.namespaces.php
Edit -- https://master.php.net/note/edit/119306
Del: integrated -- https://master.php.net/note/delete/119306/integrated
Del: useless -- https://master.php.net/note/delete/119306/useless
Del: bad code -- https://master.php.net/note/delete/119306/bad+code
Del: spam -- https://master.php.net/note/delete/119306/spam
Del: non-english -- https://master.php.net/note/delete/119306/non-english
Del: in docs -- https://master.php.net/note/delete/119306/in+docs
Del: other reasons-- https://master.php.net/note/delete/119306
Reject -- https://master.php.net/note/reject/119306
Search -- https://master.php.net/manage/user-notes.php