View Single Post
Old 09-15-2009, 08:42 AM  
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
That should work, it might be a little overkill with all the valid character checking though :P

You could also:

$arr = explode('=', $youTubeURL);

and validate just the portion you want:

$linkCode = $arr[count($arr)-1];

While that wouldn't work with the last case you posted you could just do a:

$youTubeUrl = str_replace('/', '=', $youTubeUrl);

before hand since you don't care what the domain is anyway... It would definitely be much faster than using regex, parsing wise :P
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote