note 119676 added to language.namespaces.definitionmultiple

From: Date: Mon, 01 Aug 2016 08:03:37 +0000
Subject: note 119676 added to language.namespaces.definitionmultiple
Groups: php.notes 
Request: Send a blank email to php-notes+get-206142@lists.php.net to get a copy of this message
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(); } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 2001:984:9373:1:c83:8c74:6637:2a2d ---- Manual Page -- http://php.net/manual/en/language.namespaces.definitionmultiple.php Edit -- https://master.php.net/note/edit/119676 Del: integrated -- https://master.php.net/note/delete/119676/integrated Del: useless -- https://master.php.net/note/delete/119676/useless Del: bad code -- https://master.php.net/note/delete/119676/bad+code Del: spam -- https://master.php.net/note/delete/119676/spam Del: non-english -- https://master.php.net/note/delete/119676/non-english Del: in docs -- https://master.php.net/note/delete/119676/in+docs Del: other reasons-- https://master.php.net/note/delete/119676 Reject -- https://master.php.net/note/reject/119676 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206142) next »