Say i have this PHP code:
$FooBar = \"a string\";
i then need a function like this:
print_var_name($FooBar);
I think you want to know variable name with it's value. You can use an associative array to achieve this.
use variable names for array keys:
$vars = array('FooBar' => 'a string');
When you want to get variable names, use array_keys($vars)
, it will return an array of those variable names that used in your $vars
array as it's keys.