3v4l.org

run code in 300+ PHP versions simultaneously
<?php $imgs = array('img 1','img 2','img 3','img 4','img 5','img 6'); $imgNames = array('name 1','name 2','name 3',); foreach($imgs as $files => $img) { if(!isset($imgNames[$files])) { $imgNames[$files] = 'no-name'; } echo 'Image: '.$img.' and Name: '.$imgNames[$files].'<br>'; } ?>
Output for 7.1.25 - 7.1.28, 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Image: img 1 and Name: name 1<br>Image: img 2 and Name: name 2<br>Image: img 3 and Name: name 3<br>Image: img 4 and Name: no-name<br>Image: img 5 and Name: no-name<br>Image: img 6 and Name: no-name<br>

preferences:
179.86 ms | 403 KiB | 163 Q