Re: Global Arrays ?
| From: | Jason Rennie | Date: | Fri, 21 Dec 2001 01:04:19 +0000 |
| Subject: | Re: Global Arrays ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78368@lists.php.net to get a copy of this message | ||
> Sounds quite odd - you may try an "echo(serialize($g_months))" in the
> function and see what you get... It may be that the code generating the
> option box has problems - this way you make sure $g_months is empty indeed.
Thanks for that. IT appears to be a problem with the function itself, as
the array is full of stuff.
I guess the next question is, what am i doing wrong here, that lets it
work with a local array but not a global one ?
function html_option_months($selected_month) {
global $g_months;
echo(serialize($g_months));
$result = "";
while (list($key, $val) = each($g_months)) {
$result .= html_option($key,$val, ($selected_month == $key));
}
return $result;
}
Jason
--
Hofstadter's Law : "It always takes longer than you expect, even when you
take Hofstadter's Law into account."