3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen_random_string($len, $dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") { $dict_len = strlen($dict); $res = ""; while ($len--) $res .= $dict[mt_rand(0, $dict_len - 1)]; return $res; } function enc_and_obfuscate($data, $enc_key) { $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc_data = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $enc_key, $data, MCRYPT_MODE_ECB, $iv); $result = base64_encode($enc_data); $result = str_replace(array("+", "/", "="), array("-", "_", ""), $result); $result = mask_enc_key($result, $enc_key); return trim($result); } function enc_and_hash($data, $enc_key) { $data = serialize($data); $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM); $enc_key = pack("H*", $enc_key); $sha_hash = hash_hmac("sha256", $data, substr(bin2hex($enc_key), -32)); $encryped_hash = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $enc_key, $data . $sha_hash, MCRYPT_MODE_CBC, $iv); $result = base64_encode($encryped_hash) . "|" . base64_encode($iv); return $result; } function dec_and_hash($data, $enc_key) { $data = explode("|", $data . "|"); $enc_data= base64_decode($data[0]); $iv = base64_decode($data[1]); if (strlen($iv) !== mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC)) { return false; } $enc_key = pack("H*", $enc_key); $result = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $enc_key, $enc_data, MCRYPT_MODE_CBC, $iv)); $sha_hash_from_result = substr($result, -64); $result = substr($result, 0, -64); $sha_hash = hash_hmac("sha256", $result, substr(bin2hex($enc_key), -32)); if ($sha_hash !== $sha_hash_from_result) { return false; } $result = unserialize($result); return $result; } function decrypt_reply_data($data) { $vars = explode(":", $data); $count_vars = count($vars); $enc_key = ""; for ($i = 1; $i < $count_vars;$i++) { $enc_key .= substr($vars[$i], 0, 1); } $data_length = substr($data, 0, 1); $data_length .= substr($data, -1); $data = substr($data, 1); $data = substr($data, 0, -1); preg_match_all("/[0-9a-zA-Z]{".$data_length."}\:./", $data, $preg_result); $data = str_replace($preg_result[0], array(), $data); $base64_data = str_replace(array("-", "_"), array("+", "/"), $data); $base64_data_parity = strlen($base64_data) % 4; if ($base64_data_parity) { $base64_data .= substr("====", $base64_data_parity); } $enc_data = base64_decode($base64_data); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $decrypted_result = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $enc_key, $enc_data, MCRYPT_MODE_ECB, $iv); return $decrypted_result; } function validate_result($data,$check_token,$md5_secret) { $cur_date = date("Ymd"); $data = decrypt_reply_data(dec_and_hash($data, md5("XTREAMCODES_FTW!"))); preg_match_all('/<(.*?)>([^<]+)<\/\1>/i', $data, $vars); $result = array(); foreach ($vars[1] as $name => $value) { $result[$value] = $vars[2][$name]; } print_r($data); if (!is_array($result)) { exit("Invalid License Server Response"); } if (empty($result["md5hash"])) { return array("status" => "Invalid"); } if ($result["md5hash"] != md5($md5_secret . $check_token)) { $result["status"] = "Invalid"; $result["description"] = "MD5 Checksum Verification Failed"; return $result; } if ($result["status"] == "Active") { $result["checkdate"] = $cur_date; $localkey = serialize($result); $localkey = base64_encode($localkey); $localkey = md5($cur_date . $md5_secret) . $localkey; $localkey = strrev($localkey); $localkey = $localkey . md5($localkey . $md5_secret); $localkey = wordwrap($localkey, 80, "\n", true); $result["localkey"] = $localkey; return $result; } } function mask_enc_key($enc_value, $enc_key) { $splitted_value = str_split($enc_key); $rand_len = rand(70, 90); $splitted_rand_len = str_split($rand_len); $enc_value = substr_replace($enc_value, $splitted_rand_len[0], 0, 0); $enc_value = substr_replace($enc_value, $splitted_rand_len[1], strlen($enc_value), 0); for ($i = 0; $i < count($splitted_value); $i++) { $enc_value = substr_replace($enc_value, "+", rand(2, strlen($enc_value) - 1), 0); } foreach ($splitted_value as $enc_key => $letter ) { $enc_value = preg_replace('/\+/', gen_random_string($rand_len) . ":" . $letter, $enc_value, 1); } return $enc_value; } $md5_secret = "96b90f3b34525c54ff21c0caa1f71d19"; if (!isset($_POST) || empty($_POST)) return; $v = array_shift($_POST); if ($data = decrypt_reply_data(dec_and_hash($v,md5("dAaCZzzzaAsdASDa!##@")))) { parse_str($data,$vars); if (isset($vars['check_token'])) { $check_token = $vars['check_token']; $md5Hash = md5( $md5_secret. $check_token); $result = '<status>Active</status>' . '<registeredname></registeredname>\n' . '<companyname></companyname>\n' . '<email></email>\n' . '<serviceid>1</serviceid>\n' . '<productid>1</productid>\n' . '<productname></productname>\n' . '<regdate>2015-02-15</regdate>\n' . '<nextduedate>2050-12-15</nextduedate>\n' . '<billingcycle></billingcycle>\n' . '<validdomain></validdomain>\n' . '<validip></validip>\n' . '<validdirectory></validdirectory>\n' . '<Something is wrongoptions>Extra Load Balancer Servers=5' . '</Something is wrongoptions>\n' . '<customfields></customfields>\n' . '<addons>name=CopyRights Removal;nextduedate=0000-00-00;status=Active|name=Detect Reshares with No permissions;nextduedate=2015-04-15;status=Active</addons>\n' . '<md5hash>'.$md5Hash.'</md5hash>'; $result = enc_and_hash(enc_and_obfuscate($result,gen_random_string(32)),md5("XTREAMCODES_FTW!")); print $result; } };

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.2.00.0000.01619.23
7.1.100.0090.00317.80
7.1.70.0360.00415.93
7.1.60.0500.01415.93
7.1.50.0640.00715.93
7.1.40.0590.00715.93
7.1.30.0460.01515.93
7.1.20.0670.00915.93
7.1.10.0490.00015.93
7.1.00.0510.00615.93
7.0.200.0430.00315.93
7.0.190.0420.00615.93
7.0.180.0550.00715.93
7.0.170.0540.00715.93
7.0.160.0630.01015.93
7.0.150.0410.00415.93
7.0.140.0440.00315.93
7.0.130.0720.01015.93
7.0.120.0730.01115.93
7.0.110.0520.00415.93
7.0.100.0520.00915.93
7.0.90.0560.00315.93
7.0.80.0390.01215.93
7.0.70.0490.00615.93
7.0.60.0470.00715.93
7.0.50.0470.00715.93
7.0.40.0050.00815.93
7.0.30.0160.00015.93
7.0.20.0090.00915.93
7.0.10.0070.00715.93
7.0.00.0000.01415.93
5.6.300.0140.04120.69
5.6.290.0140.04020.73
5.6.280.0040.05321.11
5.6.270.0100.08421.02
5.6.260.0180.04420.92
5.6.250.0160.04321.10
5.6.240.0040.05821.13
5.6.230.0100.04620.91
5.6.220.0160.06920.96
5.6.210.0110.04221.03
5.6.200.0250.04021.10
5.6.190.0150.03921.08
5.6.180.0070.06320.93
5.6.170.0070.04720.83
5.6.160.0100.04520.81
5.6.150.0090.07220.89
5.6.140.0070.09121.08
5.6.130.0070.07720.89
5.6.120.0090.07621.05
5.6.110.0250.06320.91
5.6.100.0120.06920.81
5.6.90.0190.05720.78
5.6.80.0100.09120.49
5.6.70.0000.07720.24
5.6.60.0140.05220.30
5.6.50.0110.03920.43
5.6.40.0100.04220.29
5.6.30.0070.04820.42
5.6.20.0070.04720.18
5.6.10.0030.05620.25
5.6.00.0070.04220.14
5.5.380.0030.04517.66
5.5.370.0100.04717.57
5.5.360.0070.08917.66
5.5.350.0100.03817.43
5.5.340.0070.04518.16
5.5.330.0130.03717.90
5.5.320.0160.06918.13
5.5.310.0070.04118.16
5.5.300.0130.04317.77
5.5.290.0100.07917.91
5.5.280.0070.06618.13
5.5.270.0120.05218.20
5.5.260.0030.04818.20
5.5.250.0030.04317.59
5.5.240.0100.06217.30
5.5.230.0150.03717.15
5.5.220.0090.03517.60
5.5.210.0030.04217.55
5.5.200.0070.03817.48
5.5.190.0000.05217.51
5.5.180.0140.05817.50
5.5.160.0030.04117.13
5.5.150.0130.04017.12
5.5.140.0130.03617.41
5.5.130.0070.04217.25
5.5.120.0070.04517.10
5.5.110.0090.03417.51
5.5.100.0040.04217.32
5.5.90.0030.04117.34
5.5.80.0060.03817.15
5.5.70.0030.05117.45
5.5.60.0100.04817.41
5.5.50.0070.04317.41
5.5.40.0100.05417.38
5.5.30.0090.03717.01
5.5.20.0100.04017.04
5.5.10.0000.04417.30
5.5.00.0030.04717.38
5.4.450.0070.05319.28
5.4.440.0070.04319.39
5.4.430.0030.07219.21
5.4.420.0040.04219.24
5.4.410.0100.03519.23
5.4.400.0090.03419.06
5.4.390.0040.04619.11
5.4.380.0070.05019.09
5.4.370.0030.04019.14
5.4.360.0000.04419.16
5.4.350.0000.04819.14
5.4.340.0070.05419.05
5.4.320.0100.03619.05
5.4.310.0070.04519.16
5.4.300.0000.04419.05
5.4.290.0030.04219.20
5.4.280.0100.04219.00
5.4.270.0100.03319.11
5.4.260.0040.04618.92
5.4.250.0070.04019.13
5.4.240.0070.04118.94
5.4.230.0030.04719.18
5.4.220.0060.03919.07
5.4.210.0110.03519.13
5.4.200.0120.03419.22
5.4.190.0040.04019.19
5.4.180.0170.06519.06
5.4.170.0000.07518.93
5.4.160.0100.03819.12
5.4.150.0060.04119.04
5.4.140.0060.04116.56
5.4.130.0130.02916.82
5.4.120.0030.03616.64
5.4.110.0040.04616.69
5.4.100.0130.03216.78
5.4.90.0070.03316.68
5.4.80.0060.04016.63
5.4.70.0030.03716.78
5.4.60.0060.04316.73
5.4.50.0000.05916.80
5.4.40.0130.04716.66
5.4.30.0100.03516.76
5.4.20.0000.04116.72
5.4.10.0090.04016.65
5.4.00.0100.07416.22
5.3.290.0060.04515.93
5.3.280.0060.04215.93
5.3.270.0030.04215.93
5.3.260.0070.04015.93
5.3.250.0100.03215.93
5.3.240.0100.03115.93
5.3.230.0100.06015.93
5.3.220.0000.05315.93
5.3.210.0100.03115.93
5.3.200.0030.04415.93
5.3.190.0030.03815.93
5.3.180.0040.05315.93
5.3.170.0100.05915.93
5.3.160.0060.03815.93
5.3.150.0030.03815.93
5.3.140.0100.05815.93
5.3.130.0070.04115.93
5.3.120.0070.04715.93
5.3.110.0030.04015.93
5.3.100.0070.03815.93
5.3.90.0030.04115.93
5.3.80.0070.03715.93
5.3.70.0060.03715.93
5.3.60.0170.06415.93
5.3.50.0070.05315.93
5.3.40.0070.03715.93
5.3.30.0100.03015.93
5.3.20.0100.07015.93
5.3.10.0030.03915.93
5.3.00.0000.04115.93
5.2.170.0030.04515.93
5.2.160.0060.02915.93
5.2.150.0120.02415.93
5.2.140.0030.03315.93
5.2.130.0140.02415.93
5.2.120.0180.03415.93
5.2.110.0090.02715.93
5.2.100.0070.02615.93
5.2.90.0040.02915.93
5.2.80.0030.03415.93
5.2.70.0040.03215.93
5.2.60.0000.03415.93
5.2.50.0090.04615.93
5.2.40.0030.03515.93
5.2.30.0030.04115.93
5.2.20.0120.02115.93
5.2.10.0060.03615.93
5.2.00.0100.05215.93
5.1.60.0040.02615.93
5.1.50.0040.03315.93
5.1.40.0130.05315.93
5.1.30.0040.03515.93
5.1.20.0070.02615.93
5.1.10.0090.02315.93
5.1.00.0030.02815.93
5.0.50.0030.02315.93
5.0.40.0030.02315.93
5.0.30.0060.02815.93
5.0.20.0000.02515.93
5.0.10.0000.02415.93
5.0.00.0070.02815.93
4.4.90.0030.01715.93
4.4.80.0040.03515.93
4.4.70.0000.02015.93
4.4.60.0040.03515.93
4.4.50.0070.02115.93
4.4.40.0030.02715.93
4.4.30.0000.03715.93
4.4.20.0040.01815.93
4.4.10.0000.01915.93
4.4.00.0040.03315.93
4.3.110.0000.01715.93
4.3.100.0070.01115.93
4.3.90.0060.02115.93
4.3.80.0030.02315.93
4.3.70.0030.01615.93
4.3.60.0070.01715.93
4.3.50.0040.01515.93
4.3.40.0060.01915.93
4.3.30.0000.01815.93
4.3.20.0070.01415.93
4.3.10.0000.01715.93
4.3.00.0030.01315.93

preferences:
41.38 ms | 400 KiB | 5 Q