Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- A newbie question on array
February 22, 2005, 3:02 pm
rate this thread
I have a list of variables, for instance
I want to know what is the max and which the name of the corresponding
variable. In other words that the max value is 16 and the varible is
I suppose that i should use an array but which kind?
Thanks in advance for your answers
Re: A newbie question on array
Use an array and don't quote numeric values:
$var = array(12, 16, 15);
Sort the array in reverse order:
reset($var); // probably not necessary
Then look at the first element, there are different ways to do that:
key($var); // returns the key of the current element
current($var); // returns the value of the current element
each($var); // returns both key and value of the current element
- » FORM METHOD=post ACTION='*.php' only sends empty spaces to mysql ?
- — Previous thread in » PHP Scripting Forum