php怎么运行余数 PHP中余数、取余的妙用

作者:袖梨 2022-06-24
 代码如下复制代码
  

$ary=array("name","egineer","sonny","tonny","pingk","apple","phone","clone","pink","colle");

foreach($aryas$key=>$value){

$key=$key+1;

if($key%2==1){echo'

  • ';}

      ?>

     

      

     if($key%2==0){echo'

  • ';}

    };

     ?>

    second_one

     代码如下复制代码

      

    $ary=array("name","egineer","sonny","tonny","pingk","apple","phone","clone","pink","colle");

    foreach($aryas$key=>$value){

    $key=$key;

    if($key%3==0){echo'

  • ';}

      ?>

     span">

      

     if($key%3==2){echo'

  • ';}

    };

     ?>


    大家可以运行以后查看结果并分析其巧妙之处~

    相关文章

    精彩推荐