Reply to constant() - php5

Your name:

Reply:


Posted by Jochem Maas on 06/29/05 16:13

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

contrived example:

<?

$cnst = "DEBUG";

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

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

PLEASE - nobody need bother to tell me about the @ operator, I am
aware of it but I don't want to use it in this case.


thanks & rgds,
jochem

[Back to original 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

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