3v4l.org

run code in 300+ PHP versions simultaneously
<?php function berekenSom($a, $b) { return $a + $b; } $resultaat = ""; if (isset($_GET['getal1']) && isset($_GET['getal2'])) { $resultaat = berekenSom($_GET['getal1'], $_GET['getal2']); } ?> <form method="get"> Getal 1: <input type="number" name="getal1"> Getal 2: <input type="number" name="getal2"> <button type="submit">optellen</button> </form> <?php if ($resultaat !== "") { echo "Resultaat: " . $resultaat; } ?><?php function berekenSom($a, $b) { return $a + $b; } $resultaat = ""; if (isset($_GET['getal1']) && isset($_GET['getal2'])) { $resultaat = berekenSom($_GET['getal1'], $_GET['getal2']); } ?> <form method="get"> Getal 1: <input type="number" name="getal1"> Getal 2: <input type="number" name="getal2"> <button type="submit">optellen</button> </form> <?php if ($resultaat !== "") { echo "Resultaat: " . $resultaat; } ?>
Output for 8.5.0 - 8.5.3
Fatal error: Cannot redeclare function berekenSom() (previously declared in /in/77rXF:3) in /in/77rXF on line 27 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.4.1 - 8.4.18
Fatal error: Cannot redeclare function berekenSom() (previously declared in /in/77rXF:3) in /in/77rXF on line 27
Process exited with code 255.
Output for 8.3.14 - 8.3.30
Fatal error: Cannot redeclare berekenSom() (previously declared in /in/77rXF:3) in /in/77rXF on line 27
Process exited with code 255.
Output for 8.3.0 - 8.3.13
Fatal error: Cannot redeclare berekenSom() (previously declared in /in/77rXF:3) in /in/77rXF on line 28
Process exited with code 255.

preferences:
51.56 ms | 706 KiB | 3 Q