How to get a variable name as a string in PHP?

Posted by Gary Willoughby on Stack Overflow See other posts from Stack Overflow or by Gary Willoughby
Published on 2008-11-01T00:28:31Z Indexed on 2010/06/15 14:22 UTC
Read the original article Hit count: 221

Filed under:

Say i have this PHP code:

$FooBar = "a string";

i then need a function like this:

print_var_name($FooBar);

which prints:

FooBar

Any Ideas how to achieve this? Is this even possible in PHP?

© Stack Overflow or respective owner

Related posts about php