1 2 3 4 5 6 7 8 9 10 11 12
foreach ($matches[1] as $key=>$value) { $from = $matches[2][$key]; $to = $matches[4][$key]; $foobar[$from] = 0; $foobar[$to] = 0; } foreach ($foobar as $key=>$value); { echo "$key = $value\n"; }