Dirk_Cologne: Fehler wohl behoben

Beitrag lesen

So geht wohl:

  
$text = "Hallo, ich bin ein Test <br><br>https://www.youtube.com/watch?v=dmX_idiAuy4<br><br>Hier noch ein Video <br><br>http://youtu.be/dmX_idiAuy4";  
  
$replace = '<iframe width="560" height="315" src="//www.youtube.com/embed/$1?rel=0" frameborder="0" allowfullscreen></iframe>';  
  
$text = preg_replace(array ("/[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i",  
"/[a-zA-Z\/\/:\.]*youtu.be\/([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i"),$replace,$text);  
  
echo $text;  

keine Ahnung ob es richtig ist, aber ich sitze 3 Tage an dem Script.