3v4l.org

run code in 300+ PHP versions simultaneously
<?php function csidAES($strMessage, $strKey, $strOperation = 'encrypt') { /** * csidAES * Provides encryption (default) and decryption suitable for use with the CSID SMS API. * @license CSID Partner Restricted * @param string $strMessage The message (cleartext or cyphertext) on which to operate. * @param string $strKey The agreed-upon encryption key. * @param string $strOperation OPTIONAL: One of 'encrypt' or 'decrypt' (default: * 'encrypt'). * @return string|bool Returns the resulting text, or FALSE on failure. */ echo $strMessage . ' is input to : ' . $strOperation . "\n"; switch ($strOperation){ case 'encrypt': echo "md5 of '".$strMessage . "' is : " . md5($strMessage) . "\n"; $AES_KEY = substr(md5($strKey), 0, 16); $iv = mcrypt_create_iv(16, MCRYPT_RAND); echo $iv . " - random generated IV\n"; //Perform encryption $ctext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $AES_KEY, $strMessage, MCRYPT_MODE_CBC, $iv); echo $ctext . " - encrypted\n"; $ctext = $iv.$ctext; echo $ctext . " - iv.ctext\n"; // Base64-encode, then urlencode the ciphertext $ctext = urlencode(base64_encode($ctext)); echo $ctext . " - url encoded ctext\n"; return $ctext; break; case 'decrypt': $key_size = mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); echo $key_size . " - key_size\n"; $AES_KEY = substr(md5($strKey), 0, 16); echo $AES_KEY . " - AES_KEY\n"; $iv = mcrypt_create_iv(16, MCRYPT_RAND); echo $iv . " - random generated IV\n"; //Perform a base64_decode. $ctext = base64_decode($strMessage); echo $ctext . " - decoded input\n"; $thIV = substr($ctext,0,16); echo "thIV : " . $thIV . "\n"; $thingForDecoding = substr($ctext,16); echo "thingForDecoding : " . $thingForDecoding . "\n"; //NOTE: No need to urldecode; the API server did it for us. //Perform decryption $ptext = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $AES_KEY, $ctext, MCRYPT_MODE_CBC, $iv); echo $ptext . " - decrypted\n"; $ptext = substr($ptext,16); echo $ptext . " - a substring of it"; $final = str_replace(chr(0),"",$ptext); echo $final . " - final"; return $final;//str_replace(chr(0),"",$ptext); break; default: return false; break; } } $csIDn = new ReflectionFunction('csidAES'); $originalText = 'Mirko Atanasov'; $encrypted = $csIDn->invoke($originalText , 'g3rWsiNm7Gwh9qMc','encrypt'); echo $encrypted; echo "\n\n and now the decryption\n\n"; $decrypted = $csIDn->invoke($encrypted, 'g3rWsiNm7Gwh9qMc','decrypt'); echo $decrypted; ?>

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.60.0180.00016.63
8.3.50.0350.01121.98
8.3.40.0060.00918.79
8.3.30.0090.00618.66
8.3.20.0000.00820.21
8.3.10.0090.00023.35
8.3.00.0040.00419.74
8.2.180.0120.00617.00
8.2.170.0140.00322.96
8.2.160.0140.00020.53
8.2.150.0040.00424.18
8.2.140.0000.00924.66
8.2.130.0050.00321.11
8.2.120.0050.00326.35
8.2.110.0060.00320.43
8.2.100.0000.01118.04
8.2.90.0050.00319.22
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0080.00017.80
8.2.50.0080.00018.07
8.2.40.0030.00520.83
8.2.30.0050.00520.66
8.2.20.0050.00217.85
8.2.10.0040.00418.21
8.2.00.0040.00418.21
8.1.280.0110.00325.92
8.1.270.0030.00618.86
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0030.00622.06
8.1.230.0080.00419.22
8.1.220.0050.00317.74
8.1.210.0090.00018.77
8.1.200.0030.00617.38
8.1.190.0040.00417.76
8.1.180.0080.00018.10
8.1.170.0030.00718.64
8.1.160.0050.00220.71
8.1.150.0040.00418.85
8.1.140.0030.00519.68
8.1.130.0030.00317.75
8.1.120.0040.00417.55
8.1.110.0040.00417.48
8.1.100.0000.00817.49
8.1.90.0000.00917.48
8.1.80.0000.00817.48
8.1.70.0030.00317.46
8.1.60.0040.00417.63
8.1.50.0040.00417.46
8.1.40.0080.00017.43
8.1.30.0040.00417.60
8.1.20.0000.00817.60
8.1.10.0040.00417.58
8.1.00.0070.00317.56
8.0.300.0000.00718.77
8.0.290.0060.00317.00
8.0.280.0000.00718.48
8.0.270.0050.00317.30
8.0.260.0060.00017.30
8.0.250.0070.00017.16
8.0.240.0030.00317.00
8.0.230.0030.00316.97
8.0.220.0030.00616.96
8.0.210.0030.00516.98
8.0.200.0000.00717.05
8.0.190.0040.00417.07
8.0.180.0080.00016.85
8.0.170.0060.00317.07
8.0.160.0000.00717.00
8.0.150.0000.00716.83
8.0.140.0070.00017.04
8.0.130.0000.00613.38
8.0.120.0040.00416.99
8.0.110.0070.00316.95
8.0.100.0030.00617.09
8.0.90.0040.00416.95
8.0.80.0100.00716.98
8.0.70.0050.00316.87
8.0.60.0050.00316.89
8.0.50.0040.00416.89
8.0.30.0110.00816.96
8.0.20.0120.00717.40
8.0.10.0020.00517.10
8.0.00.0080.01116.83
7.4.330.0050.00016.71
7.4.320.0000.00616.57
7.4.300.0040.00416.56
7.4.290.0000.00716.59
7.4.280.0050.00316.47
7.4.270.0000.00716.73
7.4.260.0030.00316.70
7.4.250.0060.00316.57
7.4.240.0040.00416.50
7.4.230.0030.00316.49
7.4.220.0070.01116.66
7.4.210.0110.00516.74
7.4.200.0030.00616.55
7.4.160.0090.00616.61
7.4.150.0100.00717.40
7.4.140.0150.00817.86
7.4.130.0070.01016.72
7.4.120.0040.01416.62
7.4.110.0100.00716.53
7.4.100.0030.01416.70
7.4.90.0090.00916.42
7.4.80.0080.01519.39
7.4.70.0100.00616.61
7.4.60.0070.01016.49
7.4.50.0040.01116.52
7.4.40.0030.01416.73
7.4.30.0130.00916.61
7.4.00.0050.01114.97
7.3.330.0060.00013.27
7.3.320.0030.00313.44
7.3.310.0040.00416.45
7.3.300.0040.00416.38
7.3.290.0030.00316.39
7.3.280.0080.00716.44
7.3.270.0030.01317.40
7.3.260.0120.00616.63
7.3.250.0110.01116.56
7.3.240.0120.00516.48
7.3.230.0070.01116.66
7.3.210.0080.00816.60
7.3.200.0030.01316.53
7.3.190.0060.01516.42
7.3.180.0130.00316.48
7.3.170.0090.00916.54
7.3.160.0100.01016.41
7.3.120.0130.00614.73
7.3.110.0070.01115.00
7.3.100.0030.01014.75
7.3.90.0040.00414.83
7.3.80.0030.01014.69
7.3.70.0030.00714.65
7.3.60.0070.00714.88
7.3.50.0030.01214.94
7.3.40.0030.00714.71
7.3.30.0030.00614.73
7.3.20.0000.01216.77
7.3.10.0030.00716.57
7.3.00.0080.00016.52
7.2.330.0130.00716.75
7.2.320.0100.01316.82
7.2.310.0070.01016.96
7.2.300.0100.01116.71
7.2.290.0090.00916.59
7.2.250.0150.00415.04
7.2.240.0070.01414.59
7.2.230.0060.00615.02
7.2.220.0000.01015.24
7.2.210.0100.00315.07
7.2.200.0000.01315.30
7.2.190.0030.01015.23
7.2.180.0110.00015.25
7.2.170.0060.01214.80
7.2.60.0140.00416.72
7.2.00.0070.00319.52
7.1.330.0030.01015.89
7.1.320.0090.00015.67
7.1.310.0000.00915.56
7.1.300.0040.00415.75
7.1.290.0070.00315.63
7.1.280.0060.00915.80
7.1.270.0030.00715.37
7.1.260.0050.00315.93
7.1.200.0100.00315.87
7.1.100.0100.00318.23
7.1.70.0000.00717.16
7.1.60.0140.01119.50
7.1.50.0040.00717.09
7.1.00.0030.07722.34
7.0.200.0000.01016.53
7.0.60.0030.08719.97
7.0.50.0100.06017.85
7.0.40.0000.05019.96
7.0.30.0370.06720.09
7.0.20.0270.07320.08
7.0.10.0070.08720.10
7.0.00.0100.08720.27
5.6.280.0070.06321.13
5.6.210.0130.08020.69
5.6.200.0100.04318.16
5.6.190.0070.08320.66
5.6.180.0630.06720.71
5.6.170.0230.03320.50
5.6.160.0100.07020.59
5.6.150.0100.05318.26
5.6.140.0030.06318.14
5.6.130.0030.05318.18
5.6.120.0100.05321.15
5.6.110.0100.06321.06
5.6.100.0070.04321.04
5.6.90.0170.03021.03
5.6.80.0030.08320.44
5.5.350.0100.03320.46
5.5.340.0200.07017.94
5.5.330.0130.06720.48
5.5.320.0070.08020.39
5.5.310.0170.04020.20
5.5.300.0000.04317.99
5.5.290.0130.06318.03
5.5.280.0100.04721.06
5.5.270.0130.08020.79
5.5.260.0130.08020.69
5.5.250.0130.06020.85
5.5.240.0200.06320.43

preferences:
40.59 ms | 401 KiB | 5 Q