How to convert an array to a string in PHP?

前端 未结 8 1142
[愿得一人]
[愿得一人] 2021-02-01 14:42

For an array like the one below; what would be the best way to get the array values and store them as a comma-separated string?

Array ( [0] => 33160,
                 


        
8条回答
  •  情书的邮戳
    2021-02-01 14:53

    I would turn it into CSV form, like so:

    $string_version = implode(',', $original_array)
    

    You can turn it back by doing:

    $destination_array = explode(',', $string_version)
    

提交回复
热议问题