Say I have a list of IDs like so:
http://www.youtube.com/watch?v=KMU0tzLwhbE
http://youtu.be/KMU0tzLwhbE
http://www.youtube.com/watch?v=KMU0tzLwhbE&featured=embedded
I need a function just to grab the ID: KMU0tzLwhbE
I'm working with something like this at the moment:
$url = "http://www.youtube.com/watch?v=KMU0tzLwhbE";
parse_str(parse_url($url, PHP_URL_QUERY ), $youtubeURL);
echo $youtubeURL['v'];
But I need it to also work for the youtube.be link. Any suggestions on how to proceed would be greatly appreciated.