3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if(isset($_POST['TO'])&&!empty($_POST['TO'])&&isset($_POST['from'])&&!empty($_POST['from'])) { $to=$_POST['TO']; $subject=$_POST['subject']; $body=$_POST['body']; $from=$_POST['from']; if(mail($to,$subject,$body,$from)) { echo 'Message sent'; } else echo 'Error in sending'; } else echo 'Enter the required fields'; ?> <form action="main.php" method="POST"> TO :<input type="text" name="TO"><br><br> SUBJECT:<input type="text" name="subject"><br><br> Message:<textarea name="body" rows="6" cols="30"></textarea><br><br> From :<input type="text" name="from"><br><br> <input type="submit" value="submit"> </form>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Enter the required fields <form action="main.php" method="POST"> TO :<input type="text" name="TO"><br><br> SUBJECT:<input type="text" name="subject"><br><br> Message:<textarea name="body" rows="6" cols="30"></textarea><br><br> From :<input type="text" name="from"><br><br> <input type="submit" value="submit"> </form>