RE: [PHP-DEV] Constants in namesapces
| From: | Dmitry Stogov | Date: | Wed, 22 Aug 2007 13:03:29 +0000 |
| Subject: | RE: [PHP-DEV] Constants in namesapces | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31836@lists.php.net to get a copy of this message | ||
You can have "const" outside namespaces but they are not real compile-time
constants.
They are set during execution in the same way as define() does.
<?php
const DIR = dirname(__FILE__);
echo DIR;
?>
Thanks. Dmitry.
> -----Original Message-----
> From: Johannes Schlьter [mailto:johannes@php.net]
> Sent: Wednesday, August 22, 2007 4:48 PM
> To: Dmitry Stogov
> Cc: 'PHP Internals List'
> Subject: Re: [PHP-DEV] Constans in namesapces
>
>
> Hi Dmitry,
>
> On Wed, 2007-08-22 at 13:02 +0400, Dmitry Stogov wrote:
> > 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
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>