fork(52) download
  1. <?php
  2. $url = "www.youtube.com/cCnrX1w5luM";
  3.  
  4.  
  5. $match;
  6. if(preg_match("/(youtube.com|youtu.be)\/(watch)?(\?v=)?(\S+)?/", $url, $match)){
  7. echo "Youtube video id is: ".$match[4];
  8. }else{
  9. echo "Sorry, not a youtube URL";
  10. }
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Youtube video id is: cCnrX1w5luM