tags:

views:

231

answers:

2

Possible Duplicate:
How to get a variable name as a string in PHP?

problem

Sometimes, I need to to show name of variable passed as argument while debugging, can I get a name of var passed to function if it exists and value if it doesn't?

example

function foo($bar){
  print_variable_name($bar); //<- this part baffles me
}

foo ("Pure string."); //output " Pure string. "
foo ($argumentvariable); //output " argumentvariable "

solution

?