This is the Code:
<?php
$matchWith = "# http://videosite.com/id1 http://videosite.com/id2 # # http://videosite.com/id3 http://videosite.com/id4 #";
preg_match_all('%(#)\shttp://videosite\.com/(\w+)\r{0,1}\shttp://videosite\.com/(\w+)\r{0,1}\s(#)%', $matchWith, $result);
foreach($result[2] as $value)
{
print '<a href="http://videosite.com/'.$value.'">
First Part
</a>';
}
foreach($result[3] as $value)
{
print '<a href="http://videosite.com/'.$value.'">
Second Part
</a>';
}
?>
The Problem:
I want it to display like this: First Part, Second Part and First Part Second Part.
But it displays it like this: First Part, First Part, Second Part, Second Part.
I really hope you understand.
Thanks
Answer assumes that the two arrays have a parallel structure.
EDIT: Changed $i== to $i++