How can I swapping a text that has links and youtube url to embed youtube video:
$text = " normal text here
youtube : http://www.youtube.com/watch?v=xxxxxx
link : http://stackoverflow.com
and some normal text here too.
";
Result :
youtube : <iframe width="529" height="315" src="//www.youtube.com/embed/YOUTUBE_URL_HERE" frameborder="0" allowfullscreen></iframe>
link : <a href="http://stackoverflow.com">http://stackoverflow.com</a>
some normal text here too.