3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _getYoutubeVideoId($url) { if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match)) { return $match[1]; } } var_dump(_getYoutubeVideoId("http://www.youtube.com/watch?feature=player_embedded&v=WQq0RAbj4i8"));
based on 5NRCY
Output for 4.3.0 - 7.1.0
string(11) "WQq0RAbj4i8"