简单PHP数组-如何获得变量的结果?

简单PHP数组-如何获得变量的结果?,php,arrays,Php,Arrays,我正在尝试获取数组的结果,并将它们移动到$变量中 这是我当前的代码: <?php $total_days_month = date('t'); // total days this month // add "$currentday" day number to an array until $currentday<=$total_days_month $days_array = array(); for ($currentday=1; $currentday<=$total

我正在尝试获取数组的结果,并将它们移动到
$变量中

这是我当前的代码:

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

// add "$currentday" day number to an array until $currentday<=$total_days_month
$days_array = array();
for ($currentday=1; $currentday<=$total_days_month; $currentday++) {
if ($total_days_month > $currentday)
{
array_push($days_array,"'$currentday',");
}
else
{
array_push($days_array,"'$currentday'");
}
}
// now transfer the array content to a $variable

$variable = ????

?>

$variable=$days\u数组而不是:
$variable=$days\u数组而不是这个:谢谢你的评论!谢谢你的评论!
$variable = implode("','", $days_array);
<?php 
$total_days_month = date('t'); // total days this month

// add "$currentday" day number to an array until $currentday<=$total_days_month
$days_array = array();
for ($currentday=1; $currentday<=$total_days_month; $currentday++) {
 if ($total_days_month > $currentday){
    array_push($days_array,"'$currentday',");
 }else{
    array_push($days_array,"'$currentday',");
 }
}

// now transfer the array content to a $variable

$variable = implode(',', $days_array);