Forum Moderators: coopster
I am trying to find out the max number of one of the values in my querystring.
Eg. www.myhost.com/index.php?var1=text&var2=text&var3=text&var4=&var5=
what i need to do is find out which var* with a value is the biggest... its is really hard to explain but the above example would return 3 because although the var* goes to var5, var5 has no value...
another example:
www.myhost.com/index.php?var1=text&var2=text&var3=text&var4=&var5=othertext&var6=
this would return 5.
Can anyone help? Sorry about the description!
First fill the array @var with your var* values, then something do like this:
for ($i=1;$i<VarsAmount;$i++) {
if ($var[$i]!='') $last_one_index = $i;
}
When you are out of the script you have your number as a value of $last_one_index.
Hope this helps.