Jump to content

Archived

This topic is now archived and is closed to further replies.

legohead6

cool thingy

Recommended Posts

Hi, Like always i was fiddling around with code(this time arrays) and i stumbled apon something cool! put this in a php pahe and upload it to your webserver! its kinda handy

[code]foreach($_SERVER as $id => $value){
echo "$id: $value<br>";
}[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=383636:date=Jun 14 2006, 12:18 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 14 2006, 12:18 AM) [snapback]383636[/snapback][/div][div class=\'quotemain\'][!--quotec--]
lol you have found the $_SERVER array. yes, lots of useful stuff in there.
[/quote]

ya, i also found $_POST $_GET $_SESSION lol...they all come in handy!

Share this post


Link to post
Share on other sites
Everyone uses those all the time in their scripts! These variables are called [a href=\"http://uk2.php.net/variables.predefined\" target=\"_blank\"]Super Globals[/a]. There are also other prefined variables too in PHP.

Share this post


Link to post
Share on other sites
... Which are documented here:

[a href=\"http://www.php.net/variables.predefined\" target=\"_blank\"]http://www.php.net/variables.predefined[/a]

Share this post


Link to post
Share on other sites
And a much easier way of dumping any of them or any array (or variable) is
[code]<?php echo '<pre>' . print_r($thearray,true) . '</pre>'; ?>[/code]

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.