php - How to merge array elements with comma separated value without using explode function
446
I want to merge array elements into comma separated values. This is an array
array:12 [
0 => array:2 [
"name" => "A1"
"project" => array:1 [
0 => "New Project"
]
]
1 => array:2 [
"name" => "A2"
"project" => array:2 [
0 => "New Project"
2 => "Project"
]
]
]
My expected array should be like this
array:12 [
0 => array:2 [
"name" => "A1"
"project" => array:1 [
0 => "New Project"
]
]
1 => array:2 [
"name" => "A2"
"project" => array:2 [
0 => "New Project","Project"
]
]
]
Need to merge New Project and Project in one position from array 2
Answer
Solution:
You can use this snippet of array_walk,
Demo.
Answer
Solution:
use implode