3v4l.org

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