communication
 databases
 directories
 file handling
 html and code
 image editing
 image listing
 sessions and co
 string handling
 information
 forms
 apple stuff
 image handling
 array handling
 lixlpixel
php - snippets
google search terms detected and highlighted.
remove highlighting | keep highlighting
make snippet in "information" - download "server variables" - open demo of "server variables"
 search
php - snippets

Valid CSS!

php webring logo
prev next
random list
join the Ring!

information - server variables was created/last modified on Mon 19 Apr 2004 8:58 AM

server variables as in $_SERVER[] are very helpful in building scripts which run on different servers.
instead of hardcoding variables these might do the trick

this snippet will produce a list of all available server variables

<?php

$str
= '<?php

     // all available server variables on '
.$_SERVER['HTTP_HOST'].'

'
;

// list all available server variables
foreach ( $_SERVER as $key=>$value )
{
     
$str .= '    $_SERVER[\''.$key.'\'] = \''.$value.'\';
'
;
}

$str .= '
'
.chr(63).'>
'
;


// output the string
highlight_string($str);

?>

learn more about some of the PHP functions used in this snippet: chr, each, for, foreach, highlight_string, key, list, var

view the GNU general license - view the GNU library license - search on PHPsnippets - see your code like this

 a lixlpixel.com site

PHParadise.com - PHP-classes.org - your site on safari