3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $video = "https://www.youtube.com/watch?v=9g30pPikveg&feature=youtu.be"; $replace = str_replace('&feature=', '', $video); echo $replace; $pattern = '#https?://(?:www\.)?youtube\.com/watch\?v=#'; $replacement = 'http://www.youtube.com/embed/'; $final = preg_replace($pattern, $replacement, $video); //echo $final;
based on 7jAY0
Output for 5.3.19 - 7.2.0
https://www.youtube.com/watch?v=9g30pPikvegyoutu.be