Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 3 行中显示条目。如果最后一行只有 1 或 2 个条目,我想用 1 或 2 个静态项目填充该行。例子。总条目是 8。我有 3 行,最后一行有 1 个空位。
使用模运算符(从除法返回结果):
if($var % 3 == 0) { //is divisible by 3 } else { //is not divisible by 3 }