Posted By

Znupi on 03/17/10


Tagged

YouTube


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Onfire60


YouTube video ID from URL


 / Published in: PHP
 

Parses any kind of YouTube URL and returns the video ID.

  1. function getYoutubeVideoID($sVideoURL) {
  2. $sVideoID = preg_replace('%.*(v=|/v/)(.+?)(/|&|\\?).*%', '$2', $sVideoURL);
  3. return $sVideoID;
  4. }

Report this snippet  

You need to login to post a comment.