How to implode subarrays in a 2-dimensional array?

前端 未结 3 1043
时光说笑
时光说笑 2020-12-06 23:56

I want to implode values in to a comma-separated string if they are an array:

I have the following array:

$my_array = [
    \"keywords\" => \"test         


        
3条回答
  •  旧时难觅i
    2020-12-07 00:11

    Just create a new array and set the elements (-;

     $value)
         $new_array[$key] = is_array($value) ? implode(",", $value) : $value;
    

提交回复
热议问题