note 113403 added to language.namespaces

From: Date: Mon, 07 Oct 2013 15:06:30 +0000
Subject: note 113403 added to language.namespaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-196483@lists.php.net to get a copy of this message
How the "\" works in the front of the namespace: The slash in front of the namespace when calling a function works like setting a path to the root directory. For instance: I want to run function "sayHello()" that exists in namespace "foo". If the calling line is NOT in a namespace I would call it like this -> "foo\sayHello();" Putting a leading slash here will not work. If the calling line IS in a namespace itself then I must call it like this -> "\foo\sayHello();" If I do not use a leading slash here the function call is seen as "\[currentNamespace]\foo\sayHello();" ---- Server IP: 69.147.83.199 Probable Submitter: 128.174.87.150 ---- Manual Page -- http://php.net/manual/en/language.namespaces.php Edit -- https://master.php.net/note/edit/113403 Del: integrated -- https://master.php.net/note/delete/113403/integrated Del: useless -- https://master.php.net/note/delete/113403/useless Del: bad code -- https://master.php.net/note/delete/113403/bad+code Del: spam -- https://master.php.net/note/delete/113403/spam Del: non-english -- https://master.php.net/note/delete/113403/non-english Del: in docs -- https://master.php.net/note/delete/113403/in+docs Del: other reasons-- https://master.php.net/note/delete/113403 Reject -- https://master.php.net/note/reject/113403 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196483) next »