I'm trying to loop tru a set of numbers based on the initial number. Tried, but cant see a good way to achieve this. The thing goes inside a while loop.
<?php
$this = 1;
//If 1 then 1,4,7
//If 2 then 3
//If 3 then 10
while ( //mySql while loop ) {
if ( $this == 1 ) {
call example() //thrice for 1, 4, 7
}
}
function example($a) {
echo $a+10;
}
?>
Here, based on what $this
is, I need to call function example. So if $this = 1
, I need to call example
thrice - $a
value 1, 4, 7
. If $this = 2
I need to call it once, value 3
.
What would be a good way to achieve this?