On Thu, Sep 25, 2008 at 6:36 PM, Roan Kattouw <roan.kattouw(a)home.nl> wrote:
I think he means that typos in those constants are
noticed better,
because mistyping a constant constitutes a syntax error while mistyping
a string doesn't.
Mistyping a constant isn't a syntax error in PHP. It's a runtime
error. This completes with no errors:
php -r "class A {} if( false ) echo A::foo;"
This gives a fatal error:
php -r "class A {} if( true ) echo A::foo;"
In other words, the constant only gives an error when it's actually
evaluated. Which is exactly the same as happens if you pass to a
function that raises a warning when a bad constant gets passed to it,
except that the error occurs marginally later (when the function
begins executing instead of immediately before it's called).