RE: [PHP] How to get the key of a specific index of array?

2003-11-19 Thread Ford, Mike [LSS]
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: >>

Re: [PHP] How to get the key of a specific index of array?

2003-11-19 Thread David Strencsev
"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

Re: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Burhan Khalid
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)

RE: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Wouter van Vliet
> -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

RE: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Jay Blanchard
[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

Re: [PHP] How to get the key of a specific index of array?

2003-11-18 Thread Marek Kilimajer
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

[PHP] How to get the key of a specific index of array?

2003-11-18 Thread PhiSYS
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