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;
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
text text text <div class="videoss videoss9_pIaI93YGY"><a href="#" class="videoshow" id="9_pIaI93YGY"><div style="background:url(/i/play.png) center no-repeat,url([zzzzz]img.youtube.com/vi/9_pIaI93YGY/mqdefault.jpg) center no-repeat;background-size:30%,cover;" class="pd39 mroim60"></div></a></div> text text text <div class="videoss videoss1PUT2a5NafI"><a href="#" class="videoshow" id="1PUT2a5NafI"><div style="background:url(/i/play.png) center no-repeat,url([zzzzz]img.youtube.com/vi/1PUT2a5NafI/mqdefault.jpg) center no-repeat;background-size:30%,cover;" class="pd39 mroim60"></div></a></div> more text more text

preferences:
152.01 ms | 409 KiB | 5 Q