We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

fris on 02/23/08


Tagged

url video YouTube


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

jonhenshaw
mmccrack


strip youtube video id from url


Published in: PHP 


  1. if(preg_match('/youtube\.com\/(v\/|watch\?v=)([\w\-]+)/', $_POST['youtube'], $match)) {;
  2. echo $match[2];
  3. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: ognevsky on February 27, 2008

You need to login to post a comment.