I have a array with some array values contains multiple values separated by comma as shown below.
$a = array( '0' => 't1,t2', '1' => 't3', '2' => 't4,t5' );
I need output in the following format.
Array ( [0] => t1 [1] => t2 [2] => t3 [3] => t4 [4] => t5 )
This is how tried and getting the results. Is there any other alternative way without looping twice.
$arr_output = array(); foreach($a as $val) { $temp = explode(',', $val); foreach($temp as $v) { $arr_output[] = $v; } }
Thanks.