PHP循环X次数 [英] PHP loop X amount of times
本文介绍了PHP循环X次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为$columns
的字符串,该字符串动态获取一个从1到7的值.我想创建一个<td></td>
循环,无论$columns
的值是多少次.知道我该怎么做吗?
I have a string called $columns
which dynamically gets a value from 1 to 7. I want to create a loop of <td></td>
for however many times the value of $columns
is. Any idea how I can do this?
推荐答案
for ($k = 0 ; $k < $columns; $k++){ echo '<td></td>'; }
这篇关于PHP循环X次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文