Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: min(eight, four)?
(Example: nine)

The Note You're Voting On

passerbyxp at gmail dot com
12 years ago
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();
}

<< Back to user notes page

To Top