note 125541 added to language.namespaces.fallback

From: Date: Thu, 26 Nov 2020 17:14:05 +0000
Subject: note 125541 added to language.namespaces.fallback
Groups: php.notes 
Request: Send a blank email to php-notes+get-215897@lists.php.net to get a copy of this message
One more precision to: "For functions and constants, PHP will fall back to global functions or constants if a namespaced function or constant does not exist." This is true only if the name does not contain a backslash. For example, the following will throw an error namespace bar { function f() { echo __FUNCTION__."\n"; } } namespace foo { bar\f(); // Error: Call to undefined function foo\bar\f() } whereas the following works nicely namespace { function f() { echo __FUNCTION__."\n"; } } namespace foo { f(); // Works nicely } ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.156.130 (proxied: 204.14.36.32) ---- Manual Page -- http://php.net/manual/en/language.namespaces.fallback.php Edit -- https://master.php.net/note/edit/125541 Del: integrated -- https://master.php.net/note/delete/125541/integrated Del: useless -- https://master.php.net/note/delete/125541/useless Del: bad code -- https://master.php.net/note/delete/125541/bad+code Del: spam -- https://master.php.net/note/delete/125541/spam Del: non-english -- https://master.php.net/note/delete/125541/non-english Del: in docs -- https://master.php.net/note/delete/125541/in+docs Del: other reasons-- https://master.php.net/note/delete/125541 Reject -- https://master.php.net/note/reject/125541 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#215897) next »