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

?

Community
  • 1
  • 1
Adam Kiss
  • 11,811
  • 9
  • 48
  • 81

0 Answers0