Re: Problem with each()
| From: | David Minor | Date: | Fri, 06 Apr 2001 14:16:23 +0000 |
| Subject: | Re: Problem with each() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47442@lists.php.net to get a copy of this message | ||
well, that didn't work either. Same error. Show me where my thinking is
wrong, if I've got an array ($HTTP_POST_VARS) in this case. and
$HTTP_POST_VARS[var_list] is an array and the first entry in the array. if
I did $x = each($HTTP_POST_VARS) in a while loop, the first combination that
is returned is $x[0] with value of 'var_list' and $x[1] with value of
'Array'. In the first instance, I passed the name of the array
($HTTP_POST_VARS) to each(), so in this instance I would again pass the name
of the array to each() to pull the value pairs out of it. This would mean
that $each_array2 = each($each_array[0]), not $each_array[1]. Am I way off?
> In article <B6F2A4D6.626C%dave@dminor.com>, dave@dminor.com says...
>
> }print("key: $each_array[0] value: $each_array[1]");
> }
> }When I get to an array within HTTP_POST_VARS, it prints:
> }key: var_name value: Array
> }
> }ok, but when I try to do an each on that array: (and maybe this is where I
> }am wrong)
> }$each_array2 = each($each_array[0])
> }
>
> There's your problem.. Your trying to do each(..) on, what in your
> example above, is set to "var_name" ...
>
> Try changing that to:
>
> $each_array2 = each($each_array[1]);
>
> It's the second variable in your example that's an Array, (or it may
> just be a string set to the word "Array".. Who knows?.. =)
>
> --
> Jeff Carnahan - jcarnahan@networq.com