3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $colours = array( 'white' => '#FFFFFF', 'red' => '#FA3438', 'orange' => '#FFA845', 'blue' => '#459CFF', 'green' => '#60C953', 'yellow' => '#F7F73B' ); $colour = isset($_GET['c']) && isset($colours[$_GET['c']]) ? $colours[$_GET['c']] : '#FFFFFF'; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <style type="text/css"> h1 { text-align: center; margin-bottom: 50px; } a { color: #000; } div.colours { width: 720px; margin: auto; background-color: #ECECEC; padding: 25px 30px; } div.colours div.colour { width: 100px; height: 100px; float: left; margin: 0 10px; border: 1px solid #888; text-align: center; padding-top: 40px; box-sizing: border-box; } </style> </head> <body style="background-color: <?= $colour ?>"> <h1>Wybierz kolor tła dla strony</h1> <div class="colours"> <? foreach ($colours as $colour => $hex): ?> <a href="?c=<?= $colour ?>"><div class="colour" style="background-color: <?= $hex ?>;"><?= $colour ?></div></a> <? endforeach; ?> <div style="clear: both;"></div> </div> </body> </html>
Output for 5.4.34 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <style type="text/css"> h1 { text-align: center; margin-bottom: 50px; } a { color: #000; } div.colours { width: 720px; margin: auto; background-color: #ECECEC; padding: 25px 30px; } div.colours div.colour { width: 100px; height: 100px; float: left; margin: 0 10px; border: 1px solid #888; text-align: center; padding-top: 40px; box-sizing: border-box; } </style> </head> <body style="background-color: #FFFFFF"> <h1>Wybierz kolor tła dla strony</h1> <div class="colours"> <a href="?c=white"><div class="colour" style="background-color: #FFFFFF;">white</div></a> <a href="?c=red"><div class="colour" style="background-color: #FA3438;">red</div></a> <a href="?c=orange"><div class="colour" style="background-color: #FFA845;">orange</div></a> <a href="?c=blue"><div class="colour" style="background-color: #459CFF;">blue</div></a> <a href="?c=green"><div class="colour" style="background-color: #60C953;">green</div></a> <a href="?c=yellow"><div class="colour" style="background-color: #F7F73B;">yellow</div></a> <div style="clear: both;"></div> </div> </body> </html>
Output for 5.4.0 - 5.4.32
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <style type="text/css"> h1 { text-align: center; margin-bottom: 50px; } a { color: #000; } div.colours { width: 720px; margin: auto; background-color: #ECECEC; padding: 25px 30px; } div.colours div.colour { width: 100px; height: 100px; float: left; margin: 0 10px; border: 1px solid #888; text-align: center; padding-top: 40px; box-sizing: border-box; } </style> </head> <body style="background-color: #FFFFFF"> <h1>Wybierz kolor tła dla strony</h1> <div class="colours"> <? foreach ($colours as $colour => $hex): ?> <a href="?c=#FFFFFF"><div class="colour" style="background-color: Notice: Undefined variable: hex in /in/VWGFk on line 56 ;">#FFFFFF</div></a> <? endforeach; ?> <div style="clear: both;"></div> </div> </body> </html>
Output for 4.3.0 - 5.3.29
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <style type="text/css"> h1 { text-align: center; margin-bottom: 50px; } a { color: #000; } div.colours { width: 720px; margin: auto; background-color: #ECECEC; padding: 25px 30px; } div.colours div.colour { width: 100px; height: 100px; float: left; margin: 0 10px; border: 1px solid #888; text-align: center; padding-top: 40px; box-sizing: border-box; } </style> </head> <body style="background-color: <?= $colour ?>"> <h1>Wybierz kolor tła dla strony</h1> <div class="colours"> <? foreach ($colours as $colour => $hex): ?> <a href="?c=<?= $colour ?>"><div class="colour" style="background-color: <?= $hex ?>;"><?= $colour ?></div></a> <? endforeach; ?> <div style="clear: both;"></div> </div> </body> </html>