SQLTerminal.app
now available

XPath.app
now available
Want fresh tech tips in your inbox?

Why are PHP5 Namespaces Defined Using a Backslash?

       

Why are PHP namespaces defined using a backslash? It looks ugly. Unless of course, there is a good reason for the "\"? Does this namespaced code run more efficiently on Windows?

Since namespaces are new in PHP5 why not take the opportunity to use them when requiring a file?


namespace('my_library_dir', 'lib'); // import my_library_dir as lib
$myClass = new lib::MyClass;      // use the class w/ namespace

Seems a lot simpler and not as ugly. You could namespace old PHP code this way as well. Please enlighten me if I'm off the mark and the implementation of namespaces in PHP5 is a better design than I have suggested!

Tagged w/ #code #namespaces #php5 #requireprogramming

Apps I've Built

XPath Expression Editor
Practice and improve your XPath skills with XPath Editor
Click to buy on the App Store
Photo Location Changer
Easily change the location on your photos and videos
Click here for more info about the app
Photo Date Changer
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app