note 80035 added to language.namespaces

From: Date: Wed, 26 Dec 2007 01:31:11 +0000
Subject: note 80035 added to language.namespaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-134006@lists.php.net to get a copy of this message
So, if I understand correctly there is a possible ambiguity that can cause a function or method to become "masked". If I have: global.php: <?php class A { static public function foo() { } } A::foo(); // Will statically call method foo() of class ::A. ?> If I now added the following to my project: A.php: <?php namespace A; function foo() { } ?> The function call above would instead call this new function. It shouldn't be a problem most of the time and specially if certain basic practices are followed (For example, don't name classes and namespaces the same name, and always keep different packages in their own separate namespaces), but it's something to keep in mind. ---- Server IP: 194.145.210.3 Probable Submitter: 217.155.84.14 ---- Manual Page -- http://www.php.net/manual/en/language.namespaces.php Edit -- https://master.php.net/note/edit/80035 Del: integrated -- https://master.php.net/note/delete/80035/integrated Del: useless -- https://master.php.net/note/delete/80035/useless Del: bad code -- https://master.php.net/note/delete/80035/bad+code Del: spam -- https://master.php.net/note/delete/80035/spam Del: non-english -- https://master.php.net/note/delete/80035/non-english Del: in docs -- https://master.php.net/note/delete/80035/in+docs Del: other reasons-- https://master.php.net/note/delete/80035 Reject -- https://master.php.net/note/reject/80035 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#134006) next »