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:[EMAIL PROTECTED] 
> 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
> 
> 

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to