Skip to content

Instantly share code, notes, and snippets.

View totoprayogo1916's full-sized avatar
🏁
🤣😂🙄😅😗

Toto totoprayogo1916

🏁
🤣😂🙄😅😗
  • Special Region of Yogyakarta, ID
View GitHub Profile
@totoprayogo1916
totoprayogo1916 / youtube_id_regex.php
Last active December 1, 2021 04:34 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ