3v4l.org

run code in 300+ PHP versions simultaneously
<?php include 'Mailer.php'; include 'Validator.php'; define("PREIS_PRO_250G", 6.20); define("PREIS_PRO_500G", 10.50); define("PORTO", 5.50); function calculateTotalPrice($menge250g, $menge500g) { $totalPrice = (PREIS_PRO_250G * $menge250g) + (PREIS_PRO_500G * $menge500g) + PORTO; $totalPrice = sprintf("%.2f", $totalPrice); return $totalPrice; } function createOKMessage($totalPrice){ $msg = '<span style="color:green"><br />Vielen Dank für Ihre Bestellung, wir werden Sie sofort nach Geldeingang bearbeiten!<br />Bitte überweisen Sie den Betrag von '; $msg .= $totalPrice; $msg .= ' EURO auf das in der E-Mail angegebene Konto.<br />'; return $msg; } function createCalcMessage($totalPrice){ $msg = '<span style="color:green"><br />Ihre aktuelle Bestellung würde '; $msg .= $totalPrice; $msg .= ' EURO kosten.<br />'; return $msg; } $name = trim(strip_tags($_POST['name'])); $email = trim(strip_tags($_POST['email'])); $strasse = trim(strip_tags($_POST['strasse'])); $plz = trim(strip_tags($_POST['plz'])); $stadt = trim(strip_tags($_POST['stadt'])); $menge250g = trim(strip_tags($_POST['menge250g'])); $menge500g = trim(strip_tags($_POST['menge500g'])); if (!isset($menge250g) or $menge250g == ""){ $menge250g = 0; } if (!isset($menge500g) or $menge500g == ""){ $menge500g = 0; } $message = NULL; $validator = new Validator(); if(isset($_POST['submit'])){ // Eingabe validieren $valid = $validator->validateInput($name, $email, $strasse, $plz, $stadt, $menge250g, $menge500g); if($valid){ // Konnte die Eingabe erfolgreich validiert werden, wird der entdgueltige Preis berechnet und // die Email an den Kunden versendet $totalPrice = calculateTotalPrice($menge250g, $menge500g); Mailer::sendToCustomer($name, $email, $strasse, $plz, $stadt, $menge250g, $menge500g, $totalPrice); $message = createOKMessage($totalPrice); $name = ""; $email = ""; $strasse = ""; $plz = ""; $stadt = ""; $menge250g = 0; $menge500g = 0; } else{ // Im Fehlerfall werden die Fehlermeldungen ausgegeben $message = $validator->getErrorMessages(); } } if(isset($_POST['calc'])){ $totalPrice = calculateTotalPrice($menge250g, $menge500g); $message = createCalcMessage($totalPrice); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; } .Stil3 { font-size: 10px } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .Stil4 { color: #000000; background-image: none; background-position: left top; } --> </style> </head> <body style="background-color: transparent;"> <form name="Bestellformular" action="<? echo $_SERVER['file:///PHP_SELF']; ?>" method="post"> <table width="380" align="left"> <tr> <td width="160"><strong>Ihr Name:</strong></td> <td width="208"><input name="name" type="text" value="<? echo $name; ?>" size="26" maxlength="100" /></td> </tr> <tr> <td width="160"><strong>E-Mail:</strong><br /> </td> <td><input name="email" type="text" id="email" value="<? echo $email; ?>" size="26" maxlength="100" /></td> </tr> <tr> <td width="160">&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td width="160"><strong>Lieferanschrift</strong><br /> </td> <td>&nbsp;</td> </tr> <tr> <td width="160"><strong>Strasse / Hausnummer</strong><br /> </td> <td><input name="strasse" type="text" id="strasse" value="<? echo $strasse; ?>" size="26" maxlength="100" /></td> </tr> <tr> <td width="160"><strong>Postleitzahl</strong><br /> </td> <td><input name="plz" type="text" id="plz" value="<? echo $plz; ?>" size="26" maxlength="5" /></td> </tr> <tr> <td width="160"><strong>Stadt</strong><br /> </td> <td><input name="stadt" type="text" id="stadt" value="<? echo $stadt; ?>" size="26" maxlength="100" /></td> </tr> <tr> <td width="160">&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td><strong>Päckchen</strong><br /> </td> <td>&nbsp;</td> </tr> <tr> <td><strong>Menge a 250g zu je 6,20€:</strong><br /> </td> <td><input name="menge250g" type="text" id="menge250g" value="<? echo $menge250g; ?>" size="26" maxlength="1" /></td> </tr> <tr> <td><strong>Menge a 500g zu je 10,50€:</strong><br /> </td> <td><input name="menge500g" type="text" id="menge500g" value="<? echo $menge500g; ?>" size="26" maxlength="1" /></td> </tr> <tr> <td width="160">&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td width="160"><strong>Versandpauschale 5,50€</strong></td> <td>&nbsp;</td> </tr> <tr> <td width="160">&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td colspan="2"><?echo $message;?></td> </tr> <tr> <td>&nbsp;</td> <td><input type="submit" value="Abschicken" name="submit" /></td> </tr> <tr> <td>&nbsp;</td> <td><input type="submit" value="Berechnen" name="calc" /></td> </tr> </table> </form> </body> </html>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: include(): open_basedir restriction in effect. File(Mailer.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 2 Warning: include(Mailer.php): Failed to open stream: Operation not permitted in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(): open_basedir restriction in effect. File(Validator.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 3 Warning: include(Validator.php): Failed to open stream: Operation not permitted in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Warning: Undefined array key "name" in /in/6LFsg on line 32 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 32 Warning: Undefined array key "email" in /in/6LFsg on line 33 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 33 Warning: Undefined array key "strasse" in /in/6LFsg on line 34 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 34 Warning: Undefined array key "plz" in /in/6LFsg on line 35 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 35 Warning: Undefined array key "stadt" in /in/6LFsg on line 36 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 36 Warning: Undefined array key "menge250g" in /in/6LFsg on line 37 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 37 Warning: Undefined array key "menge500g" in /in/6LFsg on line 38 Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6LFsg on line 38 Fatal error: Uncaught Error: Class "Validator" not found in /in/6LFsg:49 Stack trace: #0 {main} thrown in /in/6LFsg on line 49
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
Warning: include(): open_basedir restriction in effect. File(Mailer.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 2 Warning: include(Mailer.php): Failed to open stream: Operation not permitted in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(): open_basedir restriction in effect. File(Validator.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 3 Warning: include(Validator.php): Failed to open stream: Operation not permitted in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Warning: Undefined array key "name" in /in/6LFsg on line 32 Warning: Undefined array key "email" in /in/6LFsg on line 33 Warning: Undefined array key "strasse" in /in/6LFsg on line 34 Warning: Undefined array key "plz" in /in/6LFsg on line 35 Warning: Undefined array key "stadt" in /in/6LFsg on line 36 Warning: Undefined array key "menge250g" in /in/6LFsg on line 37 Warning: Undefined array key "menge500g" in /in/6LFsg on line 38 Fatal error: Uncaught Error: Class "Validator" not found in /in/6LFsg:49 Stack trace: #0 {main} thrown in /in/6LFsg on line 49
Process exited with code 255.
Output for 8.0.13
Warning: include(Mailer.php): Failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(Validator.php): Failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Warning: Undefined array key "name" in /in/6LFsg on line 32 Warning: Undefined array key "email" in /in/6LFsg on line 33 Warning: Undefined array key "strasse" in /in/6LFsg on line 34 Warning: Undefined array key "plz" in /in/6LFsg on line 35 Warning: Undefined array key "stadt" in /in/6LFsg on line 36 Warning: Undefined array key "menge250g" in /in/6LFsg on line 37 Warning: Undefined array key "menge500g" in /in/6LFsg on line 38 Fatal error: Uncaught Error: Class "Validator" not found in /in/6LFsg:49 Stack trace: #0 {main} thrown in /in/6LFsg on line 49
Process exited with code 255.
Output for 7.4.33
Warning: include(Mailer.php): failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(Validator.php): failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Uncaught Error: Class 'Validator' not found in /in/6LFsg:49 Stack trace: #0 {main} thrown in /in/6LFsg on line 49
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
Warning: include(): open_basedir restriction in effect. File(Mailer.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 2 Warning: include(Mailer.php): failed to open stream: Operation not permitted in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(): open_basedir restriction in effect. File(Validator.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 3 Warning: include(Validator.php): failed to open stream: Operation not permitted in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Uncaught Error: Class 'Validator' not found in /in/6LFsg:49 Stack trace: #0 {main} thrown in /in/6LFsg on line 49
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: include(Mailer.php): failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(Validator.php): failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Fatal error: Uncaught Error: Class 'Validator' not found in /in/6LFsg:49 Stack trace: #0 {main} thrown in /in/6LFsg on line 49
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: include(): open_basedir restriction in effect. File(Mailer.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 2 Warning: include(Mailer.php): failed to open stream: Operation not permitted in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(): open_basedir restriction in effect. File(Validator.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/6LFsg on line 3 Warning: include(Validator.php): failed to open stream: Operation not permitted in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Class 'Validator' not found in /in/6LFsg on line 49
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
Warning: include(Mailer.php): failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(Validator.php): failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Class 'Validator' not found in /in/6LFsg on line 49
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Warning: include(Mailer.php): failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: include(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: include(Validator.php): failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: include(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Class 'Validator' not found in /in/6LFsg on line 49
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: main(Mailer.php): failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: main(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: main(Validator.php): failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: main(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Class 'Validator' not found in /in/6LFsg on line 49
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Warning: main(Mailer.php): failed to open stream: No such file or directory in /in/6LFsg on line 2 Warning: main(): Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: main(Validator.php): failed to open stream: No such file or directory in /in/6LFsg on line 3 Warning: main(): Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Cannot instantiate non-existent class: validator in /in/6LFsg on line 49
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(Mailer.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/6LFsg on line 2 Warning: main() [http://www.php.net/function.main]: Failed opening 'Mailer.php' for inclusion (include_path='.:') in /in/6LFsg on line 2 Warning: main(Validator.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/6LFsg on line 3 Warning: main() [http://www.php.net/function.main]: Failed opening 'Validator.php' for inclusion (include_path='.:') in /in/6LFsg on line 3 Notice: Undefined index: name in /in/6LFsg on line 32 Notice: Undefined index: email in /in/6LFsg on line 33 Notice: Undefined index: strasse in /in/6LFsg on line 34 Notice: Undefined index: plz in /in/6LFsg on line 35 Notice: Undefined index: stadt in /in/6LFsg on line 36 Notice: Undefined index: menge250g in /in/6LFsg on line 37 Notice: Undefined index: menge500g in /in/6LFsg on line 38 Fatal error: Cannot instantiate non-existent class: validator in /in/6LFsg on line 49

preferences:
340.62 ms | 404 KiB | 456 Q