这是我的代码:

    <?php
$sss = "SELECT tanggal_awal FROM libur_nasional GROUP BY tanggal_awal ASC";
$qqq = mysqli_query($konek,$sss);
$arr = array();
while ( $tam = mysqli_fetch_array($qqq)) {
    $date = $tam['tanggal_awal'];
    $reformat_date =  date("n-j-Y", strtotime($date));
    $arr[] = $reformat_date;
}
$array_date = implode(",", $arr);

?>



> output : 8-9-2018,8-10-2018,8-17-2018
> output i want to is : "8-9-2018", "8-10-2018", "8-17-2018"


有人可以帮我得到我想要的输出,谢谢。

最佳答案

$arr=['8-9-2018','8-10-2018','8-17-2018'];

$array_date = '"'.implode('", "', $arr) . '"';
echo $array_date;


输出--->“ 8-9-2018”,“ 8-10-2018”,“ 8-17-2018”

尝试像这样破坏您的数组。

关于php - 在每个数组中给出双引号和逗号分隔符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51723123/

10-13 05:07