This article mainly introduces the wonderful use of remainder and remainder in PHP. This is a frequently used tips in WEB development, whether in HTML processing such as tables, ul, li, or line breaks, line breaks are required, and ul is added to the lines.
This article mainly introduces the wonderful use of remainder and remainder in PHP. This is a frequently used tips in WEB development, whether in HTML processing such as tables, ul, li, or line breaks, line breaks are required, and ul is added to the lines.
<? 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'
';}?> <? Php echo $ key. ":". $ value;?> <? Php if ($ key % 2 = 0) {echo'';}};?>
Second_one
<? 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'
';}?> <? Php echo $ key. ":". $ value;?> <? Php if ($ key % 3 = 2) {echo'';}};?>
You can view and analyze the results after running it ~
,