3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = 'http://localhost/img'; $dir = 'C:\Program Files\Apache Group\Apache2\htdocs\img'; $max = 5; //$images = preg_grep('/\.(?:jpe?g|gif|png)\z/i', scandir($dir)); $images = array( 'a.jpg', 'b.GIF', 'C.png', 'd.JPEg', 'a.jpg', 'b.GIF', 'C.png', 'd.JPEg', 'a.jpg', 'b.GIF', 'C.png', 'd.JPEg', ); array_walk($images, function (&$v) { $v = $url . $v; }); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <h1><?=$dir?>内の画像一覧</h1> <?php if (!$images): ?> <p>表示する画像はありません</p> <?php else: ?> <table> <tr> <?php foreach ($images as $i => $img): ?> <?php if ($i !== 0 && $i % $max === 0): ?> </tr> <tr> <?php endif; ?> <td><img src="<?=$img?>"></td> <?php endforeach; ?> </tr> </table> <?php endif; ?> </body> </html>
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <h1>C:\Program Files\Apache Group\Apache2\htdocs\img内の画像一覧</h1> <table> <tr> <td><img src="a.jpg"></td> <td><img src="b.GIF"></td> <td><img src="C.png"></td> <td><img src="d.JPEg"></td> <td><img src="a.jpg"></td> </tr> <tr> <td><img src="b.GIF"></td> <td><img src="C.png"></td> <td><img src="d.JPEg"></td> <td><img src="a.jpg"></td> <td><img src="b.GIF"></td> </tr> <tr> <td><img src="C.png"></td> <td><img src="d.JPEg"></td> </tr> </table> </body> </html>
Output for 5.3.0 - 5.3.29
Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 Notice: Undefined variable: url in /in/rdC1W on line 26 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <h1><?=$dir?>内の画像一覧</h1> <table> <tr> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> </tr> <tr> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> </tr> <tr> <td><img src="<?=$img?>"></td> <td><img src="<?=$img?>"></td> </tr> </table> </body> </html>
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/rdC1W on line 25
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/rdC1W on line 25
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/rdC1W on line 25
Process exited with code 255.