3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Erstellt für 01art Webdesign * Datei: mail.php * Beschreibung: E-Mail-Klasse * * Autor: Ernesto Giménez <e@01art.de> * Contributors: * Datum: 28.03.13 12:42 * Letzte Änderung: 02.05.2013 */ class eMail { private $filterdomain, $name, $text, $recipient; public function __construct() { $this->custom_input = ""; } public function setDomain($domain) { $this->filterdomain = $domain; } public function setName($name) { $this->name = $this->spamproof($name); $this->name = $this->charakterproof($this->name); } public function setSiteName($sitename) { $this->sitename = addslashes($sitename); } public function setText($text) { $this->text = $this->spamproof($text); } public function setKopf($kopf) { $this->kopf = $kopf; } public function setRecipient($recipient) { $this->recipient = $this->spamproof($recipient); } public function setRedirect($redirect) { $this->redirect = $redirect; } public function ehost() { return gethostbyaddr($_SERVER["REMOTE_ADDR"]); } public function evaluate($email) { if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { return "nonvalid-email"; } $email = $this->charakterproof($email); return $this->spamproof($email); } public function recode_charset($string,$cs_from,$cs_to) { // Umcodierung $trans_tbl["ASCII"] = array("&", "¡", "€", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "é", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"); $trans_tbl["UNICODE"] = array("&#x26;", "&#161;", "&#8364;", "&#162;", "&#163;", "&#164;", "&#165;", "&#166;", "&#167;", "&#168;", "&#169;", "&#170;", "&#171;", "&#172;", "&#173;", "&#174;", "&#175;", "&#176;", "&#177;", "&#178;", "&#179;", "&#180;", "&#181;", "&#182;", "&#183;", "&#184;", "&#185;", "&#186;", "&#187;", "&#188;", "&#189;", "&#190;", "&#191;", "&#192;", "&#193;", "&#194;", "&#195;", "&#196;", "&#197;", "&#198;", "&#199;", "&#200;", "&#201;", "&#202;", "&#203;", "&#204;", "&#205;", "&#206;", "&#207;", "&#208;", "&#209;", "&#210;", "&#211;", "&#212;", "&#213;", "&#214;", "&#215;", "&#216;", "&#217;", "&#218;", "&#219;", "&#220;", "&#221;", "&#222;", "&#223;", "&#224;", "&#225;", "&#226;", "&#227;", "&#228;", "&#229;", "&#230;", "&#231;", "&#232;", "&#233;", "&#234;", "&#235;", "&#236;", "&#237;", "&#238;", "&#239;", "&#240;", "&#241;", "&#242;", "&#243;", "&#244;", "&#245;", "&#246;", "&#247;", "&#248;", "&#249;", "&#250;", "&#251;", "&#252;", "&#253;", "&#254;", "&#255;"); $trans_tbl["HTML"] = array("&amp;", "&iexcl;", "&euro;", "&cent;", "&pound;", "&curren;", "&yen;", "&brvbar;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&shy;", "&reg;", "&macr;", "&deg;", "&plusmn;", "&sup2;", "&sup3;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&sup1;", "&ordm;", "&raquo;", "&frac14;", "&frac12;", "&frac34;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&ETH;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&times;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&Yacute;", "&THORN;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;"); return str_replace($trans_tbl[$cs_from], $trans_tbl[$cs_to], $string); } public function define_sonderzeichen() { $sonderzeichen=array( "ö" => "ö", "ü" => "ü", "ß" => "ß","ä" => "ä", "Ä" => "Ä", "Ãœ" => "Ü", "Ö" => "Ö", "é" => "é", "è" => "é", "ê" => "ê", "á" => "á", "²" => "²", "°" => "°", "ñ" => "ñ", "Ã'" => "Ñ", "à " => "à", "ô" => "ô", "€" => "€", "'" => "\"", "„" => "\"", "‘" => "\"", "’" => "'", "Â" => " "); return $sonderzeichen; } private function spamproof($objekt) { // old proof /* if ((preg_match("/@".$this->filterdomain."/i", $email)) || (preg_match("/@aol.com/i", $this->name)) || (preg_match("/@/i", $this->name)) || (preg_match("/url=http/i", $this->text)) || (preg_match("/Content-Type:/i", $this->text)) || (preg_match("/bcc:/i", $email)) || (preg_match("/Content-Type:/i", $this->text)) || (preg_match("/bcc:/i", $this->text)) ) { header ("Location: http://".$this->filterdomain."/"); exit(); } return $email; */ if ( preg_match("/(to:|cc:|bcc:|from:|subject:|reply-to:|content-type:|MIME-Version:|multipart\/mixed|Content-Transfer-Encoding:)/ims", $objekt)) { header("Location: http://".$this->filterdomain."/"); exit(); } return $objekt; } private function charakterproof($objekt) { if (preg_match("/%0A|%0D|%00|\\0|%09|%01|%02|%03|%04|%05|%06|%07|%08|%09|%0B|%0C|%0E|%0F|%10|%11|%12|%13/i", $objekt)) { header("Location: http://".$this->filterdomain."/"); exit(); } return $objekt; } public function edate() { $hourdiff = "0"; // hours difference between server time and local time $timeadjust = ($hourdiff * 60 * 60); return date("d F Y, G:i:s",time() + $timeadjust); } private function eheader($email) { $header = "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/plain; charset=UTF-8\r\n"; $header .= "Content-Transfer-Encoding: 8bit\r\n"; $header .= "From: \"$this->name\"<$email>\r\n"; //$header .= "bcc: $recipient\r\n"; $header .= "Return-path: $this->recipient\r\n"; $header .= "X-Mailer: 01art Webdesign Internet-Mailer \r\n"; return $header; } private function email_send_template($email) { mail( $this->recipient, $this->sitename." E-Mail-Form", email_content($email). //"=======================================================\n". $this->kopf . //"\n=======================================================\n" . PHP_EOL . //"Date of entry : " . $this->edate() . " o'clock \nMr/Mrs " . $this->name . //" has given the following information: " . PHP_EOL . //"\n____________________________________________________________\n\n" . PHP_EOL . //"CONTACT\n" . PHP_EOL . //"Name: " . $this->name . //"\nEmail: ". $email . $this->custom_input . //"\n____________________________________________________________\n\n" . PHP_EOL . //"Message: \n" . $this->text . //"\n____________________________________________________________\n" . PHP_EOL . //"____________________________________________________________\n" . PHP_EOL . //"Browser and operating system of the sender : " . $_SERVER['HTTP_USER_AGENT'] . //"\nIP of the sender : ".$_SERVER['REMOTE_ADDR']." \nRemote Host of the sender : " . $this->ehost(), $this->eheader($email) ); return; } private static function email_content($email){ $mainContent = "=======================================================\n".$this->kopf. "\n=======================================================\n" . PHP_EOL . "Date of entry : " . $this->edate() . " o'clock \nMr/Mrs " . $this->name . " has given the following information: " . PHP_EOL . "\n____________________________________________________________\n\n" . PHP_EOL . "CONTACT\n" . PHP_EOL . "Name: " . $this->name . "\nEmail: ". $email . $this->custom_input . "\n____________________________________________________________\n\n" . PHP_EOL . "Message: \n" . $this->text . "\n____________________________________________________________\n" . PHP_EOL . "____________________________________________________________\n" . PHP_EOL . "Browser and operating system of the sender : " . $_SERVER['HTTP_USER_AGENT'] . "\nIP of the sender : ".$_SERVER['REMOTE_ADDR']." \nRemote Host of the sender : " . ";"; return $this->mainContent; } public static function fillContent(){ return $mainContent; } public function send_mail($from) { if (isset($from)) { $email = $this->evaluate($from); } if (isset($this->name, $email) && ($email != "nonvalid-email") ){ $this->email_send_template($email); header("Location: ".$this->redirect); } else {exit(); } } }

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)
7.4.00.0070.01415.12
7.3.120.0070.01414.82
7.3.110.0130.00714.55
7.3.100.0060.01014.72
7.3.90.0040.01114.46
7.3.80.0080.00614.60
7.3.70.0040.00814.63
7.3.60.0100.00314.51
7.3.50.0060.00614.90
7.3.40.0070.00414.78
7.3.30.0100.00314.77
7.3.20.0000.01016.22
7.3.10.0100.00316.52
7.3.00.0070.00716.56
7.2.250.0070.01414.66
7.2.240.0030.01614.60
7.2.230.0100.00614.89
7.2.220.0040.01215.22
7.2.210.0040.01214.81
7.2.200.0090.00314.84
7.2.190.0040.01115.09
7.2.180.0050.00515.00
7.2.170.0030.01014.82
7.2.160.0070.01014.75
7.2.150.0100.00316.64
7.2.140.0070.00716.83
7.2.130.0000.01716.78
7.2.120.0130.00316.86
7.2.110.0030.01416.80
7.2.100.0080.00816.70
7.2.90.0000.01216.63
7.2.80.0090.00616.96
7.2.70.0060.00616.82
7.2.60.0040.01116.80
7.2.50.0070.00416.85
7.2.40.0000.01216.81
7.2.30.0110.00316.70
7.2.20.0140.00016.63
7.2.10.0040.01116.82
7.2.00.0080.00618.06
7.1.330.0060.00615.41
7.1.320.0120.00615.45
7.1.310.0070.00715.63
7.1.300.0030.00715.52
7.1.290.0070.00415.54
7.1.280.0060.00915.34
7.1.270.0080.00015.73
7.1.260.0060.00615.63
7.1.250.0060.00315.43
7.1.240.0140.00015.64
7.1.230.0030.00615.36
7.1.220.0030.00915.75
7.1.210.0040.00715.68
7.1.200.0090.00615.61
7.1.190.0030.01215.76
7.1.180.0070.00715.61
7.1.170.0000.01015.60
7.1.160.0100.00715.52
7.1.150.0070.01015.79
7.1.140.0030.00615.70
7.1.130.0000.01315.39
7.1.120.0030.01215.41
7.1.110.0060.00915.68
7.1.100.0050.00816.87
7.1.90.0040.01115.38
7.1.80.0000.01515.48
7.1.70.0050.00516.35
7.1.60.0060.00617.30
7.1.50.0100.01325.07
7.1.40.0030.01015.58
7.1.30.0040.01115.62
7.1.20.0090.00615.28
7.1.10.0060.00615.43
7.1.00.0040.02418.98
7.0.330.0060.00315.13
7.0.320.0070.00715.43
7.0.310.0030.01015.18
7.0.300.0000.01014.94
7.0.290.0040.01115.23
7.0.280.0060.00615.19
7.0.270.0080.00515.38
7.0.260.0060.00315.23
7.0.250.0030.00915.08
7.0.240.0050.00315.39
7.0.230.0090.00314.93
7.0.220.0120.00615.44
7.0.210.0070.01115.14
7.0.200.0020.00815.81
7.0.190.0040.01215.19
7.0.180.0080.00515.27
7.0.170.0100.00315.21
7.0.160.0060.00615.32
7.0.150.0090.00015.21
7.0.140.0100.03618.49
7.0.130.0030.01015.43
7.0.120.0110.00415.37
7.0.110.0110.00315.27
7.0.100.0040.03017.56
7.0.90.0050.03317.73
7.0.80.0120.04017.58
7.0.70.0080.03317.55
7.0.60.0050.04317.64
7.0.50.0310.04517.90
7.0.40.0190.03316.65
7.0.30.0070.02616.48
7.0.20.0070.03016.66
7.0.10.0120.04316.57
7.0.00.0090.03916.71
5.6.400.0080.00614.59
5.6.390.0120.00314.20
5.6.380.0120.00313.96
5.6.370.0060.00313.93
5.6.360.0030.00914.44
5.6.350.0070.01114.47
5.6.340.0000.01114.38
5.6.330.0060.00314.16
5.6.320.0040.01114.36
5.6.310.0050.01014.07
5.6.300.0000.01414.02
5.6.290.0000.00914.14
5.6.280.0060.03817.57
5.6.270.0060.00914.04
5.6.260.0060.00914.22
5.6.250.0000.03217.30
5.6.240.0020.03017.40
5.6.230.0030.04817.34
5.6.220.0050.02817.49
5.6.210.0050.02917.46
5.6.200.0050.02517.75
5.6.190.0120.02517.63
5.6.180.0070.04817.71
5.6.170.0100.02317.63
5.6.160.0120.02117.75
5.6.150.0050.04317.64
5.6.140.0130.02217.65
5.6.130.0070.04317.78
5.6.120.0030.03717.64
5.6.110.0070.04617.66
5.6.100.0080.04617.55
5.6.90.0030.04817.39
5.6.80.0080.04017.22
5.6.70.0110.02317.17
5.6.60.0110.04017.27
5.6.50.0110.03217.29
5.6.40.0080.04017.33
5.6.30.0070.03717.35
5.6.20.0070.04517.31
5.6.10.0050.03017.26
5.6.00.0050.03917.22
5.5.380.0070.04217.36
5.5.370.0070.02917.29
5.5.360.0090.03817.36
5.5.350.0100.03717.15
5.5.340.0110.04517.24
5.5.330.0130.04317.64
5.5.320.0080.02717.49
5.5.310.0070.03017.38
5.5.300.0080.04017.49
5.5.290.0050.03517.41
5.5.280.0040.03717.26
5.5.270.0030.03717.67
5.5.260.0070.04717.26
5.5.250.0060.03017.36
5.5.240.0110.03817.12
5.5.230.0050.04717.13
5.5.220.0080.02517.26
5.5.210.0060.02917.21
5.5.200.0070.02717.05
5.5.190.0030.02717.28
5.5.180.0080.04217.01
5.5.170.0060.00913.71
5.5.160.0040.02716.94
5.5.150.0020.04117.05
5.5.140.0050.04617.18
5.5.130.0030.04817.11
5.5.120.0020.04617.30
5.5.110.0060.02517.18
5.5.100.0010.04317.17
5.5.90.0050.04217.00
5.5.80.0000.03117.03
5.5.70.0020.02817.22
5.5.60.0070.02517.05
5.5.50.0060.02117.13
5.5.40.0090.02616.86
5.5.30.0050.02317.04
5.5.20.0030.02417.13
5.5.10.0020.02317.12
5.5.00.0000.03316.87
5.4.450.0030.04715.17
5.4.440.0090.03215.22
5.4.430.0030.04515.06
5.4.420.0060.03415.09
5.4.410.0040.03715.03
5.4.400.0120.03014.83
5.4.390.0070.04514.79
5.4.380.0000.04414.97
5.4.370.0000.04114.80
5.4.360.0100.03714.99
5.4.350.0030.03014.94
5.4.340.0070.03614.94
5.4.330.0030.00310.78
5.4.320.0050.03714.80
5.4.310.0030.03814.97
5.4.300.0050.04214.79
5.4.290.0050.04114.97
5.4.280.0100.03514.88
5.4.270.0070.03315.02
5.4.260.0080.02014.79
5.4.250.0050.04014.97
5.4.240.0040.01815.03
5.4.230.0070.02015.04
5.4.220.0050.02214.95
5.4.210.0040.02214.92
5.4.200.0050.02215.01
5.4.190.0030.02214.89
5.4.180.0030.02715.06
5.4.170.0030.01914.97
5.4.160.0030.02215.01
5.4.150.0050.02115.02
5.4.140.0030.02113.47
5.4.130.0050.02513.67
5.4.120.0030.02213.55
5.4.110.0050.01913.70
5.4.100.0040.02013.51
5.4.90.0030.02313.74
5.4.80.0030.02313.77
5.4.70.0030.02013.65
5.4.60.0030.02013.55
5.4.50.0000.02213.72
5.4.40.0040.02213.77
5.4.30.0020.02813.55
5.4.20.0020.02313.66
5.4.10.0060.02813.70
5.4.00.0010.02313.44
5.3.290.0030.03412.59
5.3.280.0010.02112.50
5.3.270.0020.02512.63
5.3.260.0050.02012.45
5.3.250.0050.02012.55
5.3.240.0020.02312.56
5.3.230.0020.02412.46
5.3.220.0050.02012.52
5.3.210.0070.03512.54
5.3.200.0060.03012.56
5.3.190.0050.02312.38
5.3.180.0040.02312.56
5.3.170.0050.02012.59
5.3.160.0050.01912.60
5.3.150.0050.02812.49
5.3.140.0050.02012.65
5.3.130.0010.02412.44
5.3.120.0030.02312.63
5.3.110.0070.02012.42
5.3.100.0070.01612.19
5.3.90.0060.02012.31
5.3.80.0030.02112.18
5.3.70.0050.02012.36
5.3.60.0020.02212.24
5.3.50.0020.02212.06
5.3.40.0030.02512.21
5.3.30.0000.02412.26
5.3.20.0030.01712.09
5.3.10.0050.01811.92
5.3.00.0050.02011.96
5.2.170.0030.03011.19
5.2.160.0070.02311.35
5.2.150.0070.02311.14
5.2.140.0000.03011.39
5.2.130.0000.03011.22
5.2.120.0070.02711.32
5.2.110.0000.04011.22
5.2.100.0000.03011.20
5.2.90.0030.02711.13
5.2.80.0070.02311.27
5.2.70.0000.03011.27
5.2.60.0000.03011.24
5.2.50.0030.03011.25
5.2.40.0000.03011.03
5.2.30.0000.03011.21
5.2.20.0030.02711.13
5.2.10.0030.02310.91
5.2.00.0000.06010.73
5.1.60.0000.02310.32
5.1.50.0030.05310.32
5.1.40.0000.03010.32
5.1.30.0100.05310.32
5.1.20.0070.05010.61
5.1.10.0000.03310.32
5.1.00.0070.04710.32
5.0.50.0030.03310.32
5.0.40.0100.03710.32
5.0.30.0000.04710.32
5.0.20.0070.04010.32
5.0.10.0070.04010.32
5.0.00.0030.03010.32
4.4.90.0000.01710.32
4.4.80.0070.01010.32
4.4.70.0000.01710.32
4.4.60.0030.01710.32
4.4.50.0000.02010.32
4.4.40.0030.04010.32
4.4.30.0000.03310.32
4.4.20.0000.01710.32
4.4.10.0000.03710.32
4.4.00.0030.05710.32
4.3.110.0030.02310.32
4.3.100.0000.03710.32
4.3.90.0000.02310.32
4.3.80.0030.05310.32
4.3.70.0030.03310.32
4.3.60.0030.03310.32
4.3.50.0000.03310.32
4.3.40.0000.03710.32
4.3.30.0030.01310.32
4.3.20.0000.03010.32
4.3.10.0030.03310.32
4.3.00.0000.02310.32

preferences:
39.53 ms | 400 KiB | 5 Q