PHP: How do you determine every Nth iteration of a loop?

后端 未结 8 1393
Happy的楠姐
Happy的楠姐 2020-11-22 13:12

I wanted to echo an image every after 3 post via XML here is my code :



        
8条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 13:58

    I am using this a status update to show a "+" character every 1000 iterations, and it seems to be working good.

    if ($ucounter % 1000 == 0) { echo '+'; }
    

提交回复
热议问题