原始变量名称传递给函数? [英] original variable name passed to function?
本文介绍了原始变量名称传递给函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复项:
PHP:获取作为参数传递的变量的名称
如何在PHP?
Possible Duplicates:
PHP: Get name of variable passed as argument
How to get a variable name as a string in PHP?
如果我有
$abc = '123';
function write($var){
}
我如何在write
内部找出现在由$var
表示的变量称为$abc
?
How would I inside write
find out that the variable now represented by $var
was called $abc
?
推荐答案
这是不可能的.即使是按引用传递也不会帮助您.您必须将名称作为第二个参数传递.
It's not possible. Even pass-by-reference won't help you. You'll have to pass the name as a second argument.
但是您肯定要问的是 并不是解决问题的好方法.
But what you have asked is most assuredly not a good solution to your problem.
这篇关于原始变量名称传递给函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文