Today post is about retrieving Youtube ID from its URL. The below PHP code will allow you to extract the ID number from the given youtube URL.
function to get the Youtube ID
/** * get_video_id() * * @param mixed $url * @return string */ function get_video_id($url) { if (!empty($url)) { parse_str(parse_url($url, PHP_URL_QUERY), $result); return $result['v']; } else { return FALSE; } } //function reference // parse_url() : //parse_str() :
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.