|
Posted by macca on 10/19/07 01:08
Just an idea, but look up get_defined_vars() in the manual.
e.g.
<?php
// Test Variables
$test_var1 = 1;
$test_var2 = 2;
$another_var = "hello";
/*
get_defined_vars() returns a multidimensional array containing a
list
of all defined variables, be them environment, server or user-
defined
variables
*** WITHIN THE SCOPE get_defined_vars() IS CALLED ***
*/
$arr = get_defined_vars();
foreach ($arr as $key=>$value){
// Shows the different vars you can access
//each one is an array of the vars in that category
switch($key){
case "GLOBALS":
continue 2;
break;
case "_POST":
continue 2;
break;
case "_GET":
continue 2;
break;
case "_COOKIE":
continue 2;
break;
case "_FILES":
continue 2;
break;
}
echo $key ." => ". $value ."<br />";
}
//========================
/*
Outputs
test_var1 => 1
test_var2 => 2
another_var => hello
*/
?>
Regards,
Paul
Navigation:
[Reply to this message]
|