note 119676 deleted from language.namespaces.definitionmultiple by cmb

From: Date: Mon, 19 Oct 2020 15:36:34 +0000
Subject: note 119676 deleted from language.namespaces.definitionmultiple by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215619@lists.php.net to get a copy of this message
Note Submitter: martin_winkel at hotmail dot com ---- In addition to kothnok at gmail dot com When using namespaces with brackets, you should define the USE statements within the brackets. His example sets the global use for the file. <?php namespace Space1; use SomeNamespace\FunctionCollection as FC; { FC\hello_world(); } namespace Space2; { // This can be used here FC\hello_world(); } ?> While the preferred method with brackets is this: <?php namespace Space1 { use SomeNamespace\FunctionCollection as FC; FC\hello_world(); } namespace Space2; { // This will not work now FC\hello_world(); } ?>

« previous php.notes (#215619) next »