scarhand Posted April 6, 2010 Share Posted April 6, 2010 I want to use a conditional statement that adds a line break every 15 posts. Example: post 1 post 2 post 3 post 4 post 5 post 6 post 7 post 8 post 9 post 10 post 11 post 12 post 13 post 14 post 15 <br /> <- added via modulus or w/e post 16 post 17 post 18 post 19 post 20 post 21 post 22 post 23 post 24 post 25 post 26 post 27 post 28 post 29 post 30 <br /> <- added via modulus or w/e post 31 post 32 I've tried using: If ($postcount % 15) echo '<br />'; Maybe I'm not totally grasping the operator. Could someone tell me the proper way to accomplish this? Link to comment https://forums.phpfreaks.com/topic/197714-help-with-modulus-operator/ Share on other sites More sharing options...
scarhand Posted April 6, 2010 Author Share Posted April 6, 2010 Is this correct?: If (($postcount % 15) == 0) echo '<br />'; Link to comment https://forums.phpfreaks.com/topic/197714-help-with-modulus-operator/#findComment-1037599 Share on other sites More sharing options...
greatstar00 Posted April 6, 2010 Share Posted April 6, 2010 u should go about if(!($postcount%15)), because 0 actually is false, and !false = true Link to comment https://forums.phpfreaks.com/topic/197714-help-with-modulus-operator/#findComment-1037600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.