I've been using parse_url and parse_str in order to get the ?v= from youtube.com links, unfortunatly it seems youtube passes video ID's that begin with both underscores and hyphens.
As a result,
$url = parse_url($url);
$vid = parse_str($url['query'], $output);
$video_id = $output['v'];
Gives me malformed ID's where -'s are changed to _ - Is there anyway to tell parse_url, parse_str to not exhibit this behaviour? or some other work around?
Ideally I want to avoid regex..