How does php obtain the function parameter name. How can I get the parameter name of the function? Solution $ testthisisatest; $ abcaaaaaaaaa; getit ($ test); functiongetit ($ l) {get the name of $ l here instead of the value when the problem occurs.
How do I get the function parameter name?
Solution
$ Test = 'This is a test ';
$ Abc = 'aaaaaaaaa ';
Getit ($ test );
Function getit ($ l ){
// Get the $ l name instead of the value here
// When $ test is used as the parameter input, the string '$ test' is displayed instead of the value of $ test.
// When $ abc is used as the parameter input, the string '$ ABC' is displayed instead of the value of $ abc.
}
[]
Reference answer
This .. Is this useful?
It does not seem to be possible.
Unless you read the file and use regular expression matching.
Reference answer
Original post published by wbsifan at [url = http://bbs.111cn.cn/redirect.php? Goto = findpost & pid = 814417 & ptid = 100342] link Mark [img] http://bbs.111cn.cn/images/common/back.gif?/img=#/url]
$ Test = 'This is a test ';
$ Abc = 'aaaaaaaaa ';
Getit ($ test );
Function getit ($ l ){
// Get the $ l name instead of the value here
// When $ test is used as the parameter input, the string '$ test' is displayed instead of the value of $ test.
// When $ abc...
According to your application?
Getit ('aaa ');
What should I display? [Img] http://www.111cn.cn/bbs/images/smilies/default/03.gif#/img]
Reference answer
Meaning. [Img] http://www.111cn.cn/bbs/images/smilies/default/lol.gif#/img]
Reference answer
Don't worry about this...
Help me think about how to get the parameter name...
Reference answer
Learning
Reference answer
I don't quite understand what you mean. in c ++, there is a reference to pass the value, pointer to pass the value, which may be useful to you.
Reference answer
Function test ($ val ){
If (is_array ($ val )){
Foreach ($ val as $ value ){
$ Arr [] = $ value;
}
Return $ arr;
} Else {
$ Val = & $ val;
Return $ val;
}
}
$ Val = 1;
Var_dump (test ($ val ));
Echo"
";
$ Arr = array (1, 2, 3 );
Print_r (test ($ arr ));
?>
Reference answer
I understand what you mean, but I don't know how to implement it. I never thought about learning before ·~ ··
Reference answer
Int (1)
Array ([0] => 1 [1] => 2 [2] => 3)
To obtain the '$ arr' string... that is, the parameter name rather than the parameter value ..
How does the handler get the function parameter name? Solution $ test = 'This is a test'; $ abc = 'aaaaaaaaa'; getit ($ test); function getit ($ l) {// Get $ l name instead of value here // when...