3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Define some constants define( "RECIPIENT_NAME", "Kitchen Interiors" ); define( "RECIPIENT_EMAIL", "info@kitcheninteriors.ca" ); define( "EMAIL_SUBJECT", "Kitchen Interiors - Visitor Message" ); // Read the form values $success = false; $senderName = isset( $_POST['senderName'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['senderName'] ) : ""; $senderEmail = isset( $_POST['senderEmail'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : ""; $message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : ""; $messagecontent = "\r\n Name:" . $senderName . "\r\n Email:" . $senderEmail . "\r\n Message:" . $message; $SpamErrorMessage = "No Websites URLs permitted"; if(preg_match("/http/i", "$senderName")) {echo "$SpamErrorMessage"; exit();} if(preg_match("/http/i", "$senderEmail")) {echo "$SpamErrorMessage"; exit();} if(preg_match("/http/i", "$message")) {echo "$SpamErrorMessage"; exit();} $recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">"; $headers = "From: " . $senderName . " <" . $senderEmail . ">"; $success = mail( $recipient, EMAIL_SUBJECT, $messagecontent, $headers ); ?> <html> <head> <title>Thank You</title> </head> <body style="background-color:#1b1b1b;"> <div style="margin-left:auto; margin-right:auto; margin-top:200px; text-align:center; color:#fff !important; font-size:24px; line-height:30px; font-weight:bold; font-family:Arial;"> <?php if ( $success ) echo "<p>Thanks for sending your message! We'll get back to you shortly.</p>" ?> <?php if ( !$success ) echo "<p>There was a problem sending your message. Please try again.</p>" ?> <p>Click your browser's Back button to return to the page.</p> </div> </body> </html>
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function mail() in /in/VqA88:23 Stack trace: #0 {main} thrown in /in/VqA88 on line 23
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function mail() in /in/VqA88:23 Stack trace: #0 {main} thrown in /in/VqA88 on line 23
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 8.0.13
Warning: mail(): Could not execute mail delivery program '/usr/sbin/sendmail -t -i' in /in/VqA88 on line 23 <html> <head> <title>Thank You</title> </head> <body style="background-color:#1b1b1b;"> <div style="margin-left:auto; margin-right:auto; margin-top:200px; text-align:center; color:#fff !important; font-size:24px; line-height:30px; font-weight:bold; font-family:Arial;"> <p>There was a problem sending your message. Please try again.</p> <p>Click your browser's Back button to return to the page.</p> </div> </body> </html>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: mail() has been disabled for security reasons in /in/VqA88 on line 23 <html> <head> <title>Thank You</title> </head> <body style="background-color:#1b1b1b;"> <div style="margin-left:auto; margin-right:auto; margin-top:200px; text-align:center; color:#fff !important; font-size:24px; line-height:30px; font-weight:bold; font-family:Arial;"> <p>There was a problem sending your message. Please try again.</p> <p>Click your browser's Back button to return to the page.</p> </div> </body> </html>

preferences:
195.14 ms | 403 KiB | 216 Q