Posted by Andy Hassall on 11/16/45 11:28
On Mon, 03 Oct 2005 22:29:48 +0200, Ewoud Dronkert
<firstname@lastname.net.invalid> wrote:
>Andy Hassall wrote:
>> In short, no.
>
>Yes, http://php.net/debug-backtrace
No,
<pre>
<?php
function debug($var) {
print_r(debug_backtrace());
}
$foo = 10;
debug($foo);
?>
</pre>
Output:
Array
(
[0] => Array
(
[file] => /home/andyh/public_html/test.php
[line] => 8
[function] => debug
[args] => Array
(
[0] => 10
)
)
)
If you can find "foo" in the above then it would do what the OP requested:
>>I'm having to pass two values - the value of the variable AND it's
>>name. Is there a way of extracting the NAME of the variable ("foo" in
>>this case) without having to pass it?
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
[Back to original message]
|