Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function convertyoutube($link) {
- if (strpos($link, 'youtube.com/watch?v=') == true) {
- $url = $link;
- parse_str(parse_url($url, PHP_URL_QUERY), $youtube_array);
- preg_match("/[^\s]*/", $youtube_array['v'], $matches);
- $videoid = $matches[0];
- $embed = "<iframe width='420' height='315' src='https://www.youtube.com/embed/".$videoid."'></iframe>"; // what it should create with the extracted code
- return $embed;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement