By panucci
via blog.agoraproduction.com
Published: Sep 30 2007 / 11:12
Namespaces has PHP 5.3 (Or the other way around): That's it. HEAD has been ported to PHP 5.3's branch. This means that the next PHP version (5.3) will have namespaces. The patch by Greg Beaver to allow multiple namespaces has not been applied yet but I sure do expect it to be applied to 5_3 and HEAD soon.
Tweet
SaveShareSend
Tags: announcement, open source, php
Comments
antych replied ago:
That's a surprise, I thought it will be PHP6 feature.
weppos replied ago:
I supposed it as well!
This is a wonderful news, however I find a little bit tricky the need to use import selecting a runtime namespace using 'as'.
It would be better to be able to declare
const Foo::Name = 'David';
echo Foo::Name;
(or something like this) instead of
namespace Foo;
const Name = 'SomePackage';
import SomePackage as Foo;
echo Foo::Name;
cornerblue replied ago:
Is it just me or is the summary on dzone insanely redundant
robse replied ago:
Good news. This will make many things easier and a lot more organized.
Also namespace qualified constants are cool.
weppos are you sure the "as" will be needed in your example? following the example i think you could say f.i.:
namespace Foo;
const Name = "x";
...
import Foo;
echo Foo::name;
robse replied ago:
So how can I edit my comment?
anyway it should be
echo Foo::Name;
weppos replied ago:
I'm looking for more docs about it.
IMHO it would be perfect a statement like
namespace Foo {
const Name = 'David';
}
echo Foo::Name;
:)
Voters For This Link (20)
Voters Against This Link (1)