3v4l.org

run code in 300+ PHP versions simultaneously
<html> <head> <title> Enviando E-mail... </title> <meta charset="UTF-8"> </head> <body> <?php // primeiro de tudo, faça uma validação nos campos para não enviar o email em branco // vou fazer só uma aqui, como exemplo // se não existir o campo email, "mata" todo o código if (!isset($_POST['email'])) { die(); } $emaildestino = $_POST['subcategoria']; $nome = $_POST['nome']; $sobrenome = $_POST['sobrenome']; $email = $_POST['email']; $telefone = $_POST['telefone']; $descricao = $_POST['mensagem']; $arquivo = $_FILES["arquivo"]; $boundary = "XYZ-".date("dmYis")."-ZYX"; $fp = fopen($arquivo["tmp_name"], "rb"); $anexo = fread($fp, filesize($arquivo["tmp_name"])); $anexo = base64_encode($anexo); fclose($fp); // cabeçalho do email $headers = "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; "; $headers .= "boundary=\"$boundary\"\r\n"; $headers .= "From: $email\n"; $headers .= "$boundary\n"; // email $data = "--$boundary\n"; $data .= "Content-Type: text/html; charset='utf-8'\n"; $data .= "<strong>Nome: </strong> $nome \r\n"; $data .= "<strong>Sobrenome: </strong> $sobrenome \r\n"; $data .= "<strong>E-mail: </strong> $email \r\n"; $data .= "<strong>Telefone: </strong> $telefone \r\n"; $data .= "<strong>Menssagem: </strong> $descricao \r\n"; $data .= "--$boundary \n"; // anexo $data .= "Content-Type: ".$arquivo["type"]."; name=".$arquivo['name']."\n"; $data .= "Content-Transfer-Encoding: base64 \n"; $data .= "Content-Disposition: attachment; filename=".$arquivo['name']."\r\n"; $data .= "$anexo \n"; $data .= "--$boundary \n"; $send = mail($emaildestino, "Email do Site Rastro Legal - Habilitações/Divergências", $data, $headers); if (!$send) { echo 'Ocorreu algum erro, tente novamente'; die(); } ?> <META HTTP-EQUIV=REFRESH CONTENT='0; URL=habilitacoes-e-divergencias'> <script type="text/javascript">alert("Mensagem Enviada com Sucesso.");</script> </body> </html>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0120.00316.58
8.3.60.0070.00716.75
8.3.50.0170.00318.04
8.3.40.0110.00720.52
8.3.30.0110.00418.75
8.3.20.0080.00024.18
8.3.10.0030.01424.66
8.3.00.0040.00426.16
8.2.190.0000.01418.54
8.2.180.0100.01025.92
8.2.170.0100.01022.96
8.2.160.0110.00322.96
8.2.150.0040.00425.66
8.2.140.0180.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00419.64
8.2.110.0060.00322.24
8.2.100.0030.00817.84
8.2.90.0000.00818.34
8.2.80.0040.00418.22
8.2.70.0040.00417.63
8.2.60.0080.00017.75
8.2.50.0080.00017.63
8.2.40.0000.00817.63
8.2.30.0000.00817.75
8.2.20.0000.00718.19
8.2.10.0000.00921.05
8.2.00.0000.00819.21
8.1.280.0040.01125.92
8.1.270.0030.00523.99
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0030.00623.96
8.1.230.0070.00422.75
8.1.220.0040.00417.74
8.1.210.0080.00018.79
8.1.200.0030.00617.35
8.1.190.0050.00317.35
8.1.180.0120.00018.10
8.1.170.0040.00417.62
8.1.160.0040.00418.77
8.1.150.0040.00418.60
8.1.140.0040.00418.88
8.1.130.0000.00818.86
8.1.120.0000.00917.41
8.1.110.0000.00717.43
8.1.100.0030.00517.32
8.1.90.0050.00217.44
8.1.80.0080.00317.46
8.1.70.0000.00717.27
8.1.60.0100.00417.48
8.1.50.0120.00217.50
8.1.40.0040.00817.50
8.1.30.0100.00217.51
8.1.20.0070.00517.51
8.1.10.0100.00317.46
8.1.00.0090.00417.41
8.0.300.0040.00419.98
8.0.290.0030.00516.63
8.0.280.0030.00618.10
8.0.270.0030.00316.80
8.0.260.0030.00318.48
8.0.250.0050.00316.97
8.0.240.0000.00716.88
8.0.230.0000.00716.99
8.0.220.0030.00316.89
8.0.210.0080.00016.89
8.0.200.0030.00316.98
8.0.190.0030.00916.93
8.0.180.0070.00616.93
8.0.170.0080.00316.83
8.0.160.0070.00416.88
8.0.150.0070.00416.89
8.0.140.0050.00616.84
8.0.130.0100.00015.04
8.0.120.0050.00715.65
8.0.110.0080.00315.71
8.0.100.0040.00715.72
8.0.90.0090.00215.63
8.0.80.0080.00315.73
8.0.70.0080.00415.70
8.0.60.0060.00515.68
8.0.50.0060.00615.73
8.0.30.0080.00415.64
8.0.20.0040.00715.76
8.0.10.0090.00215.80
8.0.00.0080.00315.82
7.4.330.0050.00015.55
7.4.320.0060.00016.53
7.4.300.0000.00616.40
7.4.290.0090.00216.49
7.4.280.0100.00316.50
7.4.270.0050.00716.50
7.4.260.0080.00314.84
7.4.250.0080.00215.35
7.4.240.0080.00415.40
7.4.230.0090.00315.37
7.4.220.0060.00615.44
7.4.210.0090.00215.39
7.4.200.0050.00615.39
7.4.190.0050.00615.44
7.4.180.0070.00515.56
7.4.160.0050.00615.44
7.4.150.0070.00515.45
7.4.140.0060.00515.27
7.4.130.0110.00015.32
7.4.120.0070.00515.33
7.4.110.0050.00615.29
7.4.100.0060.00615.39
7.4.90.0110.00015.35
7.4.80.0070.00415.28
7.4.70.0050.00615.29
7.4.60.0090.00215.26
7.4.50.0050.00615.17
7.4.40.0080.00315.18
7.4.30.0060.00515.33
7.4.20.0060.00215.22
7.4.10.0060.00515.31
7.4.00.0090.00215.23
7.3.330.0080.00216.36
7.3.320.0070.00314.79
7.3.310.0090.00215.18
7.3.300.0070.00515.21
7.3.290.0060.00515.25
7.3.280.0090.00215.15
7.3.270.0060.00515.06
7.3.260.0040.00615.17
7.3.250.0020.00815.12
7.3.240.0060.00415.13
7.3.230.0070.00315.25
7.3.220.0020.00815.21
7.3.210.0040.00615.21
7.3.200.0060.00415.25
7.3.190.0080.00315.14
7.3.180.0060.00415.08
7.3.170.0070.00315.07
7.3.160.0070.00315.07
7.3.150.0070.00315.12
7.3.140.0080.00315.06
7.3.130.0040.00615.14
7.3.120.0040.00615.20
7.3.110.0030.00715.01
7.3.100.0080.00215.08
7.3.90.0080.00215.29
7.3.80.0080.00215.07
7.3.70.0030.00715.21
7.3.60.0050.00515.23
7.3.50.0060.00415.12
7.3.40.0070.00215.14
7.3.30.0050.00415.25
7.3.20.0050.00516.36
7.3.10.0070.00316.28
7.3.00.0050.00516.37

preferences:
48.95 ms | 401 KiB | 5 Q