note 125541 rejected from language.namespaces.fallback by cmb

From: Date: Thu, 26 Nov 2020 17:27:10 +0000
Subject: note 125541 rejected from language.namespaces.fallback by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215898@lists.php.net to get a copy of this message
Note Submitter: mikael at tharzen dot com ---- 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 }

« previous php.notes (#215898) next »