On Saturday, 30 April 2011 at 17:52, Andre Polykanine wrote:
Hello Walkinraven,
> 
> I use serialize for that.
> define("MY_CONSTANT", serialize(array("1", "2", "hello")));
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> My blog: http://oire.org/menelion (mostly in Russian)
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion

That's not a class constant. That type of constant is not defined until that 
line is executed (so an array is a valid value), whereas class constants are 
declared when the file is parsed.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


> ------------ Original message ------------
> From: Walkinraven <walkinra...@gmail.com>
> To: php-general@lists.php.net
> Date created: , 12:51:15 PM
> Subject: [PHP] Why Constants could Not be Array?
> 
> 
>  For needing a constants=array, I have to use
> 'public static $a = array(...)'
> 
> instead.
> 
> Why the language could not relax the restriction of constants?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to