Reply to Re: How to get the source code of a method/function call?

Your name:

Reply:


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'.
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация