Link Details

Link 45031 thumbnail
User 196507 avatar

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.
  • 20
  • 1
  • 2209
  • 473

Comments

Add your comment
User 233461 avatar

antych replied ago:

0 votes Vote down Vote up Reply

That's a surprise, I thought it will be PHP6 feature.

User 231687 avatar

weppos replied ago:

0 votes Vote down Vote up Reply

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;

User 246294 avatar

cornerblue replied ago:

0 votes Vote down Vote up Reply

Is it just me or is the summary on dzone insanely redundant

User 249616 avatar

robse replied ago:

0 votes Vote down Vote up Reply

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;

User 249616 avatar

robse replied ago:

0 votes Vote down Vote up Reply

So how can I edit my comment?

anyway it should be
echo Foo::Name;

User 231687 avatar

weppos replied ago:

0 votes Vote down Vote up Reply

I'm looking for more docs about it.
IMHO it would be perfect a statement like

namespace Foo {
const Name = 'David';
}

echo Foo::Name;

:)

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.