You are here: Re: [PHP] Class Constant PHP 5 « PHP « IT news, forums, messages
Re: [PHP] Class Constant PHP 5

Posted by Stephen Leaf on 12/07/05 20:20

Dynamically setting a constant would break the very rule of it being a
constant in the first place.
a constant is something that does not change it cannot be dynamic.

On Wednesday 07 December 2005 12:00, Jeffrey Sambells wrote:
> is there a way to dynamically define a class constant during runtime
> in PHP 5?
>
> for example I would like to achieve the result of something like:
>
> class Example {
> const FOO = bar();
> }
>
> However this would obviously give a parse error.
>
> I know it is possible with variables but I would like it to be a
> constant.
>
> Thanks.
>
> - Jeff
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Jeffrey Sambells
> Director of Research and Development
> Zend Certified Engineer (ZCE)
>
> We-Create Inc.
> jeff@wecreate.com email
> 519.745.7374 office
> 519.897.2552 mobile
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Get Mozilla Firefox at
> http://spreadfirefox.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация