The wonderful use of remainder and remainder in PHP, the wonderful use of remainder in php_PHP tutorial

WBOY
Release: 2016-07-13 09:48:18
Original
1068 people have browsed it

The wonderful use of remainder and remainder in PHP, the wonderful use of remainder in PHP

<&#63;php
 
$ary=array("name","egineer","sonny","tonny","pingk","apple","phone","clone","pink","colle");
foreach($ary as $key=>$value){
$key=$key+1;
if($key%2==1){echo '<li>';}
  &#63;>
 <span><&#63;php echo $key.":". $value;&#63;></span>
 
<&#63;php
 if($key%2==0){echo '</li>';}
};
 &#63;>
Copy after login

second_one

 <&#63;php
 
$ary=array("name","egineer","sonny","tonny","pingk","apple","phone","clone","pink","colle");
foreach($ary as $key=>$value){
$key=$key;
if($key%3==0){echo '<li>';}
  &#63;>
 <span class="<&#63;php echo($key%3); &#63;>span"><&#63;php echo $key.":". $value;&#63;></span>
 
<&#63;php
 if($key%3==2){echo '</li>';}
};
 &#63;>
Copy after login

You can check the results and analyze the cleverness after running it~

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1024132.htmlTechArticleThe wonderful use of remainder and remainder in PHP, the wonderful use of remainder in php php $ary=array("name","egineer ","sonny","tonny","pingk","apple","phone","clone","pink","colle");foreach($ary as $key=$value){$key= $...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template