<?php
$url = "www.youtube.com/cCnrX1w5luM";
$match;
if(preg_match("/(youtube.com|youtu.be)\/(watch)?(\?v=)?(\S+)?/", $url, $match)){ echo "Youtube video id is: ".$match[4];
}else{
echo "Sorry, not a youtube URL";
}
PD9waHAKJHVybCA9ICJ3d3cueW91dHViZS5jb20vY0NuclgxdzVsdU0iOwoKCiRtYXRjaDsKaWYocHJlZ19tYXRjaCgiLyh5b3V0dWJlLmNvbXx5b3V0dS5iZSlcLyh3YXRjaCk/KFw/dj0pPyhcUyspPy8iLCAkdXJsLCAkbWF0Y2gpKXsKCWVjaG8gIllvdXR1YmUgdmlkZW8gaWQgaXM6ICIuJG1hdGNoWzRdOwp9ZWxzZXsKCWVjaG8gIlNvcnJ5LCBub3QgYSB5b3V0dWJlIFVSTCI7Cn0=