I am trying to return array strings based on position, concatenate and append into a new array.
$matches = ([0] => 20170623 004129 982 a [4] => 20170623 004130 982 b [8] =>
20170623 004130 982 b)
foreach ($matches as $match){
$arr2 = explode(" ", $match);
echo $arr2[0] . $arr2[1] . $arr2[2];
The for loop works for explode and can see each element(strings) of the array being separated into a new array $arr2, but each pass through the loop overwrites $arr2. My echo is returning the same result (the result of the last pass) multiple times. Looks like once for each pass.
Expected output, maybe something like:
$arr3 = ([0] => 20170623004129982 [1] => 20170623004130982 [3] =>
20170623004130982)