loop help...[solved]
Posted: Tue Mar 14, 2006 11:17 am
I am passing in three different instances of the same varaiables in to a function...
i.e 2, 5 and 7($variable) and 3,4,9 ($moreV) (all stored in an array)
These are being passed in using a loop (foreach loop) to this function.
For each variable instance i pass in, i want to perform some calculations...
so this is what i have so far...
This causes an infinte loop and if i put a print statement in, it continues to print the variable over and over.
I simply want to use each instance one at a time.
Using an IF statement prints all instances. (i.e 3, 4, 9)
How can i perform calculations on the different instances in turn?
Cheers
i.e 2, 5 and 7($variable) and 3,4,9 ($moreV) (all stored in an array)
These are being passed in using a loop (foreach loop) to this function.
For each variable instance i pass in, i want to perform some calculations...
so this is what i have so far...
Code: Select all
<?php
function name($variable, $moreV)
{
while ($variable = 2) {
//do something... (print $moreV)
}
}
?>I simply want to use each instance one at a time.
Using an IF statement prints all instances. (i.e 3, 4, 9)
How can i perform calculations on the different instances in turn?
Cheers