On 19 November 2003 12:59, David Strencsev contributed these pearls of wisdom:
> "Wouter Van Vliet" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>
>> First of all, you said to use the first three values of the
> array for
> anoter
>> reason .. well the, what I'd do is this:
>>
"Wouter Van Vliet" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> First of all, you said to use the first three values of the array for
anoter
> reason .. well the, what I'd do is this:
>
> $FirstThree = array_splice($_POST, 0, 3);
>
> Which will give you the first three elements o
PhiSYS wrote:
How to get the key of a specific index of array?
Sorry, but an index is they key.
$foo = array(0 => "Apples", 1 => "Oranges", 2 => "Grapes");
$key = 2;
$value = $foo[$key];
echo $value; //you would get Grapes
//another way (maybe this is what you are after)
while(list($key,$value)
> -Oorspronkelijk bericht-
> Van: PhiSYS [mailto:[EMAIL PROTECTED]
>
> 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);
>
> fo
[snip]
How to get the key of a specific index of array?
[/snip]
http://us2.php.net/manual/en/function.array-keys.php
That manualamazing, no?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
PhiSYS wrote:
How to get the key of a specific index of array?
It seems that key($_POST[$i]) is a wrong syntax.
$i is the key, key is the index.
I think you are overcomplicating it. Tell us what you want to achieve
and someone might come out with a better solution.
Marek
--
PHP General Mailing
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
7 matches
Mail list logo