Mark Baker Mark Baker - 1 year ago 51
PHP Question

libxml constants are accessible, yet don't register as defined constants

According to the PHP documentation, there are a number of constants defined when the libxml extension is enabled.

These are accessible in the code, so something like


will return a value of
(no problem so far, that's exactly what I expect to see)

What puzzles me is if I do

echo var_dump(defined(LIBXML_DTDLOAD));

I get a

So how can I access the constant and see its value if it isn't (apparently) defined? Or why does
return a false for a constant that clearly is defined?


jbe jbe
Answer Source

You didn't quote the constant name

var_dump(defined('LIBXML_DTDLOAD')); // bool(true)