生成用逗号分隔的数字

时间:2014-10-04 23:54:35

标签: php

我正在试图弄清楚如何生成以逗号分隔的x数字,并在变量($ total_days_month)中定义最大限制。

<?php
$total_days_month = date('t'); // get total days of this month

// generate numbers separated with comma from 1 until $total_days_month

?>

1 个答案:

答案 0 :(得分:2)

echo implode(',', range(1, $total_days_month));