Say i have this PHP code:
$FooBar = \"a string\";
i then need a function like this:
print_var_name($FooBar);
I couldn't think of a way to do this efficiently either but I came up with this. It works, for the limited uses below.
shrug
// Returns
Array
(
[0] => $foo
[1] => foo
)
Array
(
[0] => $bar
[1] => bar
)
Array
(
[0] => $baz
[1] => baz
)
It works based on the line that called the function, where it finds the argument you passed in. I suppose it could be expanded to work with multiple arguments but, like others have said, if you could explain the situation better, another solution would probably work better.