Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespaces in php 1

Status
Not open for further replies.

jpadie

Technical User
Nov 24, 2003
10,094
FR
I'm probably the only one that hadn't noticed that namespaces have been introduced in php as of 5.3.0. For those that are not in the know i've written a very brief post here
 
If you just noticed that, you may also have missed that the namespace separator has changed from :: to \. So accessing a static class method through a namespace now looks like this
Code:
namespace\subnamespace\class::method()
And as an added bonus, not only is this syntax painfully ugly and inconsistent with the syntax of every other similar language, but now you have to remember to watch your quoting/escaping if you want to pass a namespaced class in a string.

So in one shot the PHP developers have managed to add a useful new feature and screw up the language even more than it already was. Sigh.... Time to go brush up on my Python....
 
really? when i checked the php manual earlier today they were on the double colon. Greg is really good at taking user feedback and he's in charge of this section of the trunk. If you've got a gripe (and i'd agree with you) then let him hear it!
 
Yeah, apparently they haven't updated the documentation yet. The decision was made last weekend and hit Slashdot on Sunday. From what I've read so far, a lot of people seem...disappointed...by this choice.
 
ah yes. i see that there is a 'documentation maybe out dated' (sic) against namespaces on the front page.

that's disappointing. the double colon made more sense.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top