join array values and with a hyphen in php

前端 未结 2 1920
無奈伤痛
無奈伤痛 2021-01-29 11:41

i have array like this :

$year = Array(
     [0] => 2019
     [1] => 2020
    );

i want to join this two array and the array values separ

2条回答
  •  情歌与酒
    2021-01-29 12:34

    Use implode:

    $array = array(
        0 => 2019, 1 => 2020
    );
    
    $string = implode('-',$array);
    echo $string;
    

提交回复
热议问题