PDA

View Full Version : Function echos variable NAME and value (PHP)



yc2
October 27th, 2010, 05:15 AM
PHP:

I often make test printouts.

I would like to make a function that echos the name and value of a variable.

For example, I would like the function to print out the name and value of the variable $hello:

Calling the function:

$hello = 7;
test_print($hello);

I would like the function to print out

hello = 7

I naturally do NOT want to put the variable name twice in the function call ($hello, 'hello')

How can I do this?

Thanks