Get Const / Static Name from Function / Method Call.

Posted by Mark Tomlin on Stack Overflow See other posts from Stack Overflow or by Mark Tomlin
Published on 2010-04-25T16:51:24Z Indexed on 2010/04/25 16:53 UTC
Read the original article Hit count: 191

Filed under:
|

I want to find the token's name passed by augment into a function.

class Norm
{
    const STR_NORM = 0;
    const INT_NORM = 0;
}

function foo($Arg1, $Arg2 = NULL)
{
    getConstName($Arg1); # Should Return STR_NORM;
    return $Arg1, $Arg2;
}

echo foo(Norm::STR_NORM);

Is there any way to impalement getConstName via the PHP Reflection API?

© Stack Overflow or respective owner

Related posts about php5

Related posts about reflection