How would I display all the variables on a current page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vwilsonjr
Forum Newbie
Posts: 1
Joined: Fri Nov 25, 2005 5:11 pm

How would I display all the variables on a current page

Post by vwilsonjr »

I want to display all the variables, session, cookies, forms ect. I'm coming from Cold Fusion where I could just simple use cfdump. Anything in PHP the same. :?:
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

http://us3.php.net/print_r

that should do ya:)
User avatar
trukfixer
Forum Contributor
Posts: 174
Joined: Fri May 21, 2004 3:14 pm
Location: Miami, Florida, USA

Post by trukfixer »

if you wanna dump everything at once.. ($_SERVER,$_COOKIE, $_SESSION,$_GET,$_POST,etc)

Code: Select all

echo "<pre>";
var_dump($GLOBALS);
//print_r also works, var_dump gives more detailed information including the data type)
otherwise you can just do var_dump($array) or var_dump($variable) or whatever and see its contents ..
I have used both print_r and var_dump, both are equivalent, print_r is less verbose, I just happen to be in teh habit of hitting var_dump first :)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

If you're slightly more confident with PHP (not just starting out) I'd throughly recommend http://xdebug.org/
Post Reply