|
Posted by Dikkie Dik on 12/17/06 17:42
You can use the eval function to go the other way around (not tested):
function traceVariable($name)
{echo $name . ' = ' . var_export(eval('return ' . $name), TRUE);}
You'd call it with traceVariable('$_SERVER[\'PHP_SELF\']');
seaside wrote:
> Andy Hassall schrieb:
>
>> On 16 Dec 2006 15:23:19 -0800, "seaside" <seaside.ki@mac.com> wrote:
>>
>>> Since the description string is very likely to be identical to the
>>> source code (string) of the first parameter, I'd like to write this:
>>>
>>> traceVariable( $_SERVER['PHP_SELF'] );
>>>
>>> Any ideas, how to get the literal expression (source) of a parameter,
>>> which got passed to a method/function?
>> See the thread "Easy question, return variable name" from just 2 days ago.
>
> Ok, no standard method available. Then, I'll use backtrace to construct
> 'something'.
>
Navigation:
[Reply to this message]
|