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, it is particularly useful when several lines need to be lined up and the ul or li end mark is added to several 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'
';}?> Span "> <? Php echo $ key. ":". $ value;?> <? Php if ($ key % 3 = 2) {echo'';}};?>
You can view and analyze the results after running it ~