|
Posted by Ken Robinson on 04/18/06 00:53
tony@tony.com wrote:
> In article <1145189729.880217.112930@i40g2000cwc.googlegroups.com>,
> damirz@gmail.com says...
> > I knew that I forgot something :/
> >
>
> Nice one. Modified slightly & tested - it works fine - as below.
> I added SERVER just to be sure of some output from a Sglobal
> So much nicer than having to do each one at a time ;-)
>
Here's another way of doing this.
<?php
// custom global array
$myArray = array("some", "elements");
// array with names of global arrays you want to access
$globalArrayNames =
array(array('$_SERVER',$_SERVER),array('$_POST',$_POST),
array("myArray",$myArray));
// parameter is global array name
function showThisArray($globalArrayName) {
echo("<br><br>" . "[ " . $globalArrayName[0] . " ]<br>");
echo '<pre>' . print_r($globalArrayName[1],true) . '</pre>';
}
showThisArray($globalArrayNames[0]);
showThisArray($globalArrayNames[1]);
showThisArray($globalArrayNames[2]);
?>
Ken
Navigation:
[Reply to this message]
|