Re: newbie - add 15 to number in list
- From: "Kimmo Laine" <spam@xxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 10:03:29 +0300
"version2" <corbett.jarrod@xxxxxxxxx> wrote in message
news:1156985921.127740.147300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi there,
I am outputing a list of 10 values.
10, 20, 30, 40, etc
I can add 15 to one of the values then reorder the values from smallest
to highest but i want to update every single value and assign it values
increamenting by 10
so after the update the second number of 20 and add 15 I get
10, 30, 35, 40
now i want to re output the values above as
10, 20, 30, 40
But this last is just the same as the original. I don't see the
difference... Was this supposed to be 10, 30, 20, 40 ?
It would help if you could explain in detail what you are trying to achieve
with this, but basicly that would go like this:
$foo = range(10,100,10);// create the list of numbers
$bar = $foo;
$foo[rand()%sizeof($foo)]+=15;// add 15 to random element.
asort($foo); // Sort the changed array
// Print the sorted changed order using the
// original values that were copied to $bar
foreach($foo as $k => $v)
echo $bar[$k] . ', ';
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
spam@xxxxxxxxxxxxx || Gedoon-S @ IRCnet || rot13(xvzzb@xxxxxxxxxxxxx)
.
- Follow-Ups:
- Re: newbie - add 15 to number in list
- From: version2
- Re: newbie - add 15 to number in list
- References:
- newbie - add 15 to number in list
- From: version2
- newbie - add 15 to number in list
- Prev by Date: Nested loops help please?
- Next by Date: Advanced topics book?
- Previous by thread: Re: newbie - add 15 to number in list
- Next by thread: Re: newbie - add 15 to number in list
- Index(es):