3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '%(?<attr>src|href)="(?<host>.*?)(?<media>/media/[^"]+)"%i'; $content = <<<CONTENT <p><img alt="" src="/media/images/logo_medias/TV/TF1.jpg" style="height:22px; width:60px" />&nbsp;&nbsp;<img alt="" src="/media/images/logo_medias/TV/W9.jpg" style="height:22px; width:60px" />&nbsp; <img alt="" src="/media/images/logo_medias/TV/Gulli.jpg" style="height:29px; width:30px" /><strong>&nbsp;</strong><img alt="" src="/media/images/logo_medias/TV/DISNEY%20CHANNEL.jpg" style="color:rgb(76, 76, 76); font-size:15.555556297302246px; height:40px; line-height:22.986112594604492px; width:44px" /><strong>&nbsp;<img alt="" src="/media/images/logo_medias/TV/NT1.jpg" style="height:29px; width:35px" /></strong>&nbsp;-&nbsp;Campagne de spots<br /> <img alt="" src="http://infoscom.umf.dev/media/images/Pluzz.jpg" style="height:219px; width:219px" /><a alt="" href="http://infoscom.umf.dev/media/images/Pluzz.jpg" style="height:219px; width:219px" /></p> CONTENT; $matching = array(); var_dump(preg_match_all($pattern, $content)); var_dump($matching);
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
int(7) array(0) { }
Output for 4.3.4 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Warning: preg_match_all() expects at least 3 parameters, 2 given in /in/vC4hv on line 15 bool(false) array(0) { }
Output for 4.4.2, 5.1.2
Warning: preg_match_all() expects at least 3 parameters, 2 given in /in/vC4hv on line 16 bool(false) array(0) { }
Output for 4.3.3
Warning: Compilation failed: unrecognized character after (?< at offset 3 in /in/vC4hv on line 15 bool(false) array(0) { }
Output for 4.3.0 - 4.3.2
Warning: Wrong parameter count for preg_match_all() in /in/vC4hv on line 15 NULL array(0) { }

preferences:
247.59 ms | 401 KiB | 354 Q