This function, along with constant(), is namespace sensitive. And it might help if you imagine them always running under the "root namespace":
<?php
namespace FOO\BAR
{
const WMP="wmp";
function test()
{
if(defined("WMP")) echo "direct: ".constant("WMP"); //doesn't work;
elseif(defined("FOO\\BAR\\WMP")) echo "namespace: ".constant("FOO\\BAR\\WMP"); //works
echo WMP; //works
}
}
namespace
{
\FOO\BAR\test();
}