- constant: documentation ( source)
<?php
class nombreclase
{
function __construct()
{
echo __METHOD__,"\n";
}
}
function nombrefunc()
{
echo __FUNCTION__,"\n";
}
const nombreconst = "global";
$a = 'nombreclase';
$obj = new $a; // imprime nombreclase::__construct
$b = 'nombrefunc';
$b(); // imprime nombrefunc
echo constant('nombreconst'), "\n"; // imprime global
?>