I have a function for dumping variables on the screen and what I'd like to do is to show the name of the variable next to the value of the variable, so it would output something like this:
function my_function($var) {
return '<pre>' . var_dump($var) . '</pre>';
}
$myVar = 'This is a variable';
echo my_function($var); // outputs on screen: myVar has value: This is a variable
$anotherVar = 'Something else';
echo my_function($anotherVar); // outputs on screen: anotherVar has value: Something else
How can I do this ?