3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reg_exUrl_youtube = '~(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com/(?:(?:watch)?\?(?:.*&)?vi?=|(?:embed|vi?|user)/))([^?&"\'>\s]+)(?![^<]*>)\S*~'; $message = 'text text text https://www.youtube.com/watch?v=9_pIaI93YGY text text text https://www.youtube.com/watch?v=1PUT2a5NafI&list=RD1PUT2a5NafI&start_radio=1 more text more text'; $message = preg_replace_callback($reg_exUrl_youtube, function($matches) { return "<div class=\"videoss videoss{$matches[1]}\"><a href=\"#\" class=\"videoshow\" id=\"{$matches[1]}\"><div style=\"background:url(/i/play.png) center no-repeat,url([zzzzz]img.youtube.com/vi/{$matches[1]}/mqdefault.jpg) center no-repeat;background-size:30%,cover;\" class=\"pd39 mroim60\"></div></a></div>"; }, $message); echo $message;

preferences:
25.7 ms | 408 KiB | 6 Q