php - What's the purpose of '\' when we create an object? -


this question has answer here:

what's purpose of using backslash \ when create object in php?

$iter = new \arrayiterator($arr);

it's used create new object of qualified class. say, you're code in namespace "namespace1":

namespace namespace1; $iter = new arrayiterator(); 

would resolved namespace1\arrayiterator(); and

$iter = new \arrayiterator(); 

would resolved arrayiterator();

see: http://php.net/manual/de/language.namespaces.basics.php more infos namespaces.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -