Hi,
The proposed patch implements namespace support for constants.
It allows to declare constants in namespaces in the same way as in classes.
And these constants may be used in the same may as namespaces' functions.
<?php
namespace Foo;
const BAR = 5;
var_dump(BAR);
?>
<?php
include "foo.php";
var_dump(Foo::BAR);
?>
I am going to commit this patch on Friday.
Any objections?
Thanks. Dmitry.
Sorry, The patch was removed.
Resending it.
Dmitry.
-----Original Message-----
From: Dmitry Stogov [mailto:dmitry@zend.com]
Sent: Wednesday, August 22, 2007 1:02 PM
To: 'PHP Internals List'
Subject: [PHP-DEV] Constans in namesapcesHi,
The proposed patch implements namespace support for
constants. It allows to declare constants in namespaces in
the same way as in classes. And these constants may be used
in the same may as namespaces' functions.<?php
namespace Foo;
const BAR = 5;
var_dump(BAR);
?><?php
include "foo.php";
var_dump(Foo::BAR);
?>I am going to commit this patch on Friday.
Any objections?Thanks. Dmitry.
Hi Dmitry,
Hi,
The proposed patch implements namespace support for constants.
It allows to declare constants in namespaces in the same way as in classes.
And these constants may be used in the same may as namespaces' functions.
I like the idea. Am I right with the assumption, from scrolling over the
patch, that "const" outside any namespace would work, too, meaning we
could get compile-time constants even outside a namespace?
johannes