How to get the key of a specific index of array?
It seems that key($_POST[$i]) is a wrong syntax.
I've worked around like this:
$allkeys = array_keys($_POST);
$allvalues = array_values($_POST);
for($I=3; $I < count($_POST); $I++) {
echo $allkeys[$I];
echo $allvalues[$I];
}
But I think that it will use the double of memory. And that won't be good
for long arrays.
So the cuestion is... Is there a PHP function to do this?
I successfully did it with ASP using Request.Form.Key(I) but I really do
prefer PHP when I'm free to choose the language.
Or how can I move the internal array pointer to a specified position to
be able to use the key() function?
As you probably noticed I started the $I counter at 3 because the first 3
values of the array will be used for other purposes. That's why I don't
want to use a foreach().
Thank you all!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php