3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_story = [ 'some-video.mp4', 'some-image.jpg' ]; foreach ($_story as $story) { $check = '/mp4/m'; preg_match_all($check, $story, $matches, PREG_SET_ORDER, 0); if (empty($matches)) { echo "<a href=$story&dl=1><img src=$story></a>\n"; } else { echo '<video width="320" height="240" controls>'."\n"; echo '<source src="' . $story . '" type="video/mp4">'."\n"; echo '</video>'."\n"; echo "<a href=$story&dl=1>Download</a>"."\n"; } } foreach ($_story as $story) { if (FALSE === strpos($story, 'mp4')) { echo "<a href=$story&dl=1><img src=$story></a>\n"; } else { echo '<video width="320" height="240" controls>'."\n"; echo '<source src="' . $story . '" type="video/mp4">'."\n"; echo '</video>'."\n"; echo "<a href=$story&dl=1>Download</a>"."\n"; } }
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.29, 7.4.0 - 7.4.21, 8.0.0 - 8.0.8
<video width="320" height="240" controls> <source src="some-video.mp4" type="video/mp4"> </video> <a href=some-video.mp4&dl=1>Download</a> <a href=some-image.jpg&dl=1><img src=some-image.jpg></a> <video width="320" height="240" controls> <source src="some-video.mp4" type="video/mp4"> </video> <a href=some-video.mp4&dl=1>Download</a> <a href=some-image.jpg&dl=1><img src=some-image.jpg></a>

preferences:
89.06 ms | 460 KiB | 5 Q