theravada_maha
asked on
Getting All the Environment Variables
How can I get all the environment variables? I'm looking for an array with keys of environment variables.
I need to access a variable without knowing its name.
Ther.
I need to access a variable without knowing its name.
Ther.
If you are using PHP4 and up, you can use:
$HTTP_ENV_VARS
this variable is an array that holds all the environment variables.
This loop will echo each Environment variable and its value:
////////////////////////// ////////// ////////// ///////
<?
foreach($HTTP_ENV_VARS as $VarName => $VarValue)
{
echo("<b>".$VarName."</b> = ".$VarValue."<BR>");
}
?>
////////////////////////// ////////// ////////// //////
$HTTP_ENV_VARS
this variable is an array that holds all the environment variables.
This loop will echo each Environment variable and its value:
//////////////////////////
<?
foreach($HTTP_ENV_VARS as $VarName => $VarValue)
{
echo("<b>".$VarName."</b> = ".$VarValue."<BR>");
}
?>
//////////////////////////
ASKER
Actually I'm looking for a way to grab the environment variables of a form, for example. Let's say I have a form that sends 45 variables to the action.php or whatever, I can't just manually recall all those variables because they're generated by php itself, how can I get those?
Eric
Eric
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great it works now, thanks!
Ther.
Ther.
ASKER
Great it works now, thanks!
Ther.
Ther.
while (list ($header, $value) = each ($headers)) {
echo "$header: $value<br>\n";
}
Jimmy