hi,

I just wanted to say about 'include' ... er no actually
I have this little thing with constant() which I asked about
on php-generals and the response from a couple of regulars
suggest it might be a bug, or more correctly, an inconsistency.

Jason Barnett wrote also:
tested with PHP 5.0.5-dev

<?php

/* Causes E_WARNING */
echo "constant('UNDEFINED_CONSTANT')\n";
echo constant('UNDEFINED_CONSTANT');

/* Causes E_NOTICE */
echo "UNDEFINED_CONSTANT\n";
echo UNDEFINED_CONSTANT;

?>

should(may) I submit a bugreport?

-------- Original Message --------
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. (addition: not for a 
warning)

thanks & rgds,
jochem

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

Reply via email to