Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting a variable name?

Status
Not open for further replies.

jaelle

Programmer
Nov 21, 2005
14
US
I'm wondering if there is a way in php to output the name of a variable. It would be very helpful for debugging if I could.
 
echo $variable;



______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
There is an alternate answer but nothing comes to mind. explain more please.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
sorry :) try [link=http://uk.php.net/var_dump]var_dump[/url] when you hit a error.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thanks! That's very close to what I'm looking for.

I don't suppose you know of a way to save that as a string? I figured out how to do it with print_r(). (Ex: $debug = print_r(get_defined_vars(),true); ), but the var_dump() seems to give better information, so that would be preferable.

Okay, perhaps I am getting overly picky. I just wanted to be able to output it out in a nicer looking manner. ^^;

 
try var_export() instead.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top