我正在尝试根据初始数字循环 tru 一组数字。尝试过,但看不到实现这一目标的好方法。这件事进入了一个while循环。
<?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;
}
?>
在这里,基于什么$this,我需要调用函数示例。所以如果$this = 1,我需要调用example三次$a值1, 4, 7。如果$this = 2我需要调用一次, value 3。
什么是实现这一目标的好方法?