PHP:获取作为参数传递的变量的名称

时间:2010-03-04 12:21:59

标签: php variables

  

可能重复:
  How to get a variable name as a string in PHP?

问题

有时,我需要在调试时显示作为参数传递的变量的名称,如果它存在则可以获得传递给函数的var的名称,如果不存在则可以获取值吗?

例如

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

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

溶液

0 个答案:

没有答案
相关问题