You are here: Re: [PHP] constant() - php5 « PHP « IT news, forums, messages
Re: [PHP] constant() - php5

Posted by Richard Davey on 06/29/05 17:00

Hello Jochem,

Wednesday, June 29, 2005, 2:13:21 PM, you wrote:

JM> anybody here know what the logic is behind constant() triggering a
JM> warning if the named constant is not found?

JM> <?
JM> $cnst = "DEBUG";

JM> // what I want to do but can't
JM> if ($dbg = constant($cnst)) {
JM> // do stuff
JM> }

JM> // the only real option, it seems - bit long winded to get round a stupid (IMHO)
JM> if (defined($cnst) && ($dbg = constant($cnst))) {
JM> // do stuff
JM> }

Isn't the warning coming from the fact that $cnst isn't defined,
rather than coming from the constant() function itself?

Best regards,

Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov

 

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

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