/ Published in: PHP

Return the YouTube video ID.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function _get_video_id( $url ) { return $url; return $url; return $url; return $url; } elseif ( preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $url, $matches) ) { return $matches[0]; } else { return false; } }
Comments
