<?php
// experiment with different types of youtube links
// the stranger, the better
$string = <<<YOUTUBE
http://www.youtube.com/watch?v=pkrM7x0_fcI&feature=channel http://www.youtube.com/watch?v=U0Wpx1JJkFw&feature=popular http://www.youtube.com/watch?v=4aJnpDtrH-A&feature=related http://www.youtube.com/watch?v=pkrM7x0_fcI&feature=channel http://www.youtube.com/watch?v=pk5M7n0_fcI&feature=channel
YOUTUBE;
$pattern = '#http://www\.youtube\.com/watch\?v=([^\&]+)\&\w+=\w+#';
$replacement = "<a class=\"flashvideo\" href=\"http://www.youtube.com/v/$1\">http://www.youtube.com/v/$1</a>";
// overriding the initial $string or you could use some other variable (e.g. $output)
$string = preg_replace($pattern, $replacement, $string);
echo $string;