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 . "<br/>"; switch ($strOperation){ case 'encrypt': echo "md5 of '".$strMessage . "' is : " . md5($strMessage) . "<br/>"; $AES_KEY = substr(md5($strKey), 0, 16); $iv = mcrypt_create_iv(16, MCRYPT_RAND); echo $iv . " - random generated IV<br/>"; //Perform encryption $ctext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $AES_KEY, $strMessage, MCRYPT_MODE_CBC, $iv); echo $ctext . " - encrypted<br/>"; $ctext = $iv.$ctext; echo $ctext . " - iv.ctext<br/>"; // Base64-encode, then urlencode the ciphertext $ctext = urlencode(base64_encode($ctext)); echo $ctext . " - url encoded ctext<br/>"; return $ctext; break; case 'decrypt': $key_size = mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); echo $key_size . " - key_size<br/>"; $AES_KEY = substr(md5($strKey), 0, 16); echo $AES_KEY . " - AES_KEY<br/>"; $iv = mcrypt_create_iv(16, MCRYPT_RAND); echo $iv . " - random generated IV<br/>"; //Perform a base64_decode. $ctext = base64_decode($strMessage); echo $ctext . " - decoded input<br/>"; $thIV = substr($ctext,0,16); echo "thIV : " . $thIV . "<br/>"; $thingForDecoding = substr($ctext,16); echo "thingForDecoding : " . $thingForDecoding . "<br/>"; //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<br/>"; $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 "<br/><br/> and now the decryption<br/><br/>"; $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.0140.00716.75
8.3.50.0090.00618.30
8.3.40.0070.00718.78
8.3.30.0070.00718.67
8.3.20.0040.00420.31
8.3.10.0000.00823.69
8.3.00.0080.00019.98
8.2.180.0120.00918.56
8.2.170.0100.01022.96
8.2.160.0130.00020.43
8.2.150.0090.00024.18
8.2.140.0030.00624.66
8.2.130.0040.00421.13
8.2.120.0060.00326.35
8.2.110.0030.00622.26
8.2.100.0000.01317.91
8.2.90.0080.00019.17
8.2.80.0000.00817.97
8.2.70.0000.00917.63
8.2.60.0040.00418.05
8.2.50.0050.00318.07
8.2.40.0030.00621.25
8.2.30.0090.00020.66
8.2.20.0050.00317.78
8.2.10.0000.00718.30
8.2.00.0040.00418.12
8.1.280.0130.01325.92
8.1.270.0000.00918.79
8.1.260.0050.00228.09
8.1.250.0080.00028.09
8.1.240.0090.00022.62
8.1.230.0040.01019.42
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0000.00817.51
8.1.180.0000.00718.10
8.1.170.0050.00318.46
8.1.160.0000.00720.82
8.1.150.0080.00018.99
8.1.140.0000.00819.56
8.1.130.0030.00517.63
8.1.120.0040.00417.49
8.1.110.0000.00817.46
8.1.100.0000.00817.51
8.1.90.0080.00317.50
8.1.80.0050.00317.36
8.1.70.0040.00417.48
8.1.60.0040.00417.68
8.1.50.0000.00917.50
8.1.40.0030.00617.49
8.1.30.0030.00617.61
8.1.20.0040.00417.53
8.1.10.0000.00717.59
8.1.00.0080.00317.48
8.0.300.0000.00718.77
8.0.290.0070.00016.88
8.0.280.0000.00718.57
8.0.270.0070.00317.32
8.0.260.0000.00617.24
8.0.250.0050.00217.07
8.0.240.0000.00616.93
8.0.230.0040.00417.09
8.0.220.0040.00416.92
8.0.210.0000.00716.94
8.0.200.0030.00317.11
8.0.190.0000.00817.07
8.0.180.0080.00016.99
8.0.170.0030.00616.92
8.0.160.0040.00417.09
8.0.150.0050.00216.92
8.0.140.0000.00716.93
8.0.130.0000.00613.48
8.0.120.0030.00516.88
8.0.110.0040.00416.97
8.0.100.0030.00617.07
8.0.90.0040.00416.81
8.0.80.0070.01416.93
8.0.70.0050.00217.04
8.0.60.0020.00517.04
8.0.50.0000.00716.97
8.0.30.0050.01117.11
8.0.20.0090.01217.40
8.0.10.0000.00816.92
8.0.00.0120.00816.70
7.4.330.0030.00316.73
7.4.320.0030.00316.58
7.4.300.0030.00316.55
7.4.290.0000.00716.59
7.4.280.0030.00616.66
7.4.270.0040.00416.71
7.4.260.0000.00716.57
7.4.250.0040.00416.51
7.4.240.0040.00416.60
7.4.230.0030.00316.78
7.4.220.0130.00616.50
7.4.210.0100.00916.65
7.4.200.0030.00316.37
7.4.160.0070.01016.43
7.4.150.0090.00917.40
7.4.140.0070.01117.86
7.4.130.0130.01816.49
7.4.120.0110.00616.57
7.4.110.0070.01016.60
7.4.100.0140.00316.66
7.4.90.0040.01416.55
7.4.80.0030.01819.39
7.4.70.0090.00816.59
7.4.60.0100.00716.56
7.4.50.0030.01316.69
7.4.40.0060.00916.80
7.4.30.0130.01016.58
7.4.10.0090.00915.08
7.4.00.0020.01514.95
7.3.330.0000.00613.15
7.3.320.0000.00613.34
7.3.310.0050.00316.39
7.3.300.0040.00416.46
7.3.290.0030.00316.33
7.3.280.0100.00616.37
7.3.270.0060.01317.40
7.3.260.0130.01016.70
7.3.250.0100.00916.43
7.3.240.0090.00916.62
7.3.230.0030.01416.45
7.3.210.0130.00416.51
7.3.200.0140.00316.68
7.3.190.0100.00716.46
7.3.180.0100.00616.59
7.3.170.0150.00616.59
7.3.160.0090.00616.66
7.3.130.0000.01615.02
7.3.120.0070.01015.05
7.3.110.0100.00914.98
7.3.100.0080.00514.95
7.3.90.0050.01314.79
7.3.80.0100.00314.88
7.3.70.0050.00514.89
7.3.60.0150.00014.89
7.3.50.0060.00814.90
7.3.40.0030.01014.79
7.3.30.0060.00514.91
7.3.20.0100.00616.77
7.3.10.0070.00416.65
7.3.00.0060.00616.62
7.2.330.0110.00716.42
7.2.320.0090.00616.75
7.2.310.0070.01016.55
7.2.300.0070.01116.86
7.2.290.0070.01416.72
7.2.260.0070.01315.23
7.2.250.0070.01115.30
7.2.240.0090.00715.05
7.2.230.0080.00615.22
7.2.220.0080.00714.94
7.2.210.0050.00915.21
7.2.200.0050.01015.02
7.2.190.0070.00915.12
7.2.180.0070.00815.04
7.2.170.0030.01115.04
7.2.160.0100.00515.14
7.2.150.0050.00916.95
7.2.140.0030.01116.82
7.2.130.0060.00816.93
7.2.120.0050.00816.96
7.2.110.0060.00616.87
7.2.100.0070.00717.02
7.2.90.0080.01017.03
7.2.80.0060.01116.89
7.2.70.0050.01017.03
7.2.60.0060.01016.87
7.2.50.0050.00917.02
7.2.40.0010.01316.96
7.2.30.0050.01116.86
7.2.20.0040.00916.88
7.2.10.0060.01016.72
7.2.00.0070.00817.71
7.1.330.0060.00815.71
7.1.320.0100.00515.60
7.1.310.0020.00916.00
7.1.300.0060.00915.73
7.1.290.0060.01115.66
7.1.280.0070.00615.76
7.1.270.0100.00215.70
7.1.260.0050.00515.87
7.1.250.0030.00815.71
7.1.240.0060.00615.84
7.1.230.0030.01015.88
7.1.220.0000.01515.91
7.1.210.0000.01415.45
7.1.200.0070.00215.76
7.1.190.0040.00815.70
7.1.180.0100.00315.69
7.1.170.0040.01115.72
7.1.160.0070.00715.95
7.1.150.0070.00715.91
7.1.140.0030.01015.90
7.1.130.0070.00415.79
7.1.120.0040.00915.93
7.1.110.0040.00415.74
7.1.100.0080.00916.75
7.1.90.0100.00715.63
7.1.80.0000.01315.67
7.1.70.0040.00516.38
7.1.60.0090.01017.66
7.1.50.0050.01416.25
7.1.40.0110.00415.88
7.1.30.0060.00315.73
7.1.20.0090.00615.68
7.1.10.0100.00315.52
7.1.00.0120.03219.15
7.0.330.0140.00015.40
7.0.320.0000.01215.61
7.0.310.0000.01715.64
7.0.300.0050.00315.15
7.0.290.0040.00715.37
7.0.280.0030.00915.33
7.0.270.0060.00615.34
7.0.260.0000.01015.50
7.0.250.0100.00715.45
7.0.240.0080.00815.55
7.0.230.0060.01015.08
7.0.220.0040.00815.44
7.0.210.0030.00715.38
7.0.200.0060.00616.08
7.0.190.0000.00915.62
7.0.180.0060.00615.45
7.0.170.0030.01315.56
7.0.160.0030.01215.34
7.0.150.0090.00315.16
7.0.140.0050.00415.61
7.0.130.0060.00315.64
7.0.120.0080.00415.55
7.0.110.0100.00715.42
7.0.100.0100.00715.30
7.0.90.0030.01015.24
7.0.80.0070.00715.46
7.0.70.0040.00815.04
7.0.60.0020.04117.63
7.0.50.0030.02416.79
7.0.40.0160.04216.88
7.0.30.0150.03316.92
7.0.20.0100.02416.81
7.0.10.0040.03616.83
7.0.00.0080.04216.71
5.6.400.0050.00514.71
5.6.390.0030.01014.55
5.6.380.0040.00714.61
5.6.370.0000.01014.13
5.6.360.0040.00814.34
5.6.350.0000.01814.30
5.6.340.0040.01114.49
5.6.330.0110.00314.27
5.6.320.0140.00014.38
5.6.310.0060.00914.52
5.6.300.0060.00914.38
5.6.290.0110.00414.52
5.6.280.0060.03917.90
5.6.270.0110.00414.46
5.6.260.0070.01014.43
5.6.250.0080.00414.39
5.6.240.0100.00314.46
5.6.230.0070.00714.14
5.6.220.0060.01014.14
5.6.210.0070.04617.43
5.6.200.0060.03316.22
5.6.190.0120.02017.50
5.6.180.0220.03417.34
5.6.170.0110.02317.32
5.6.160.0000.04917.49
5.6.150.0030.04816.27
5.6.140.0050.04516.22
5.6.130.0030.04516.19
5.6.120.0100.04017.59
5.6.110.0050.04317.58
5.6.100.0050.02517.79
5.6.90.0030.02717.85
5.6.80.0020.04117.29
5.6.70.0040.00814.27
5.6.60.0070.00714.19
5.6.50.0080.00614.59
5.6.40.0070.00714.18
5.6.30.0070.00714.45
5.6.20.0060.01314.50
5.6.10.0110.00414.04
5.6.00.0070.00714.50
5.5.380.0070.00414.33
5.5.370.0070.01014.07
5.5.360.0080.00414.36
5.5.350.0050.02017.40
5.5.340.0030.02616.23
5.5.330.0090.03717.34
5.5.320.0090.04517.34
5.5.310.0150.03117.37
5.5.300.0030.02316.00
5.5.290.0040.03316.06
5.5.280.0050.02717.55
5.5.270.0060.03317.63
5.5.260.0120.03317.58
5.5.250.0050.05017.52
5.5.240.0110.03517.21
5.5.230.0000.01114.25
5.5.220.0030.00614.37
5.5.210.0060.00314.27
5.5.200.0110.00414.39
5.5.190.0040.01314.07
5.5.180.0000.01714.23
5.5.170.0060.01214.16
5.5.160.0090.00614.15
5.5.150.0110.00314.47
5.5.140.0000.01014.15
5.5.130.0070.00614.41
5.5.120.0030.00914.18
5.5.110.0070.00714.33
5.5.100.0060.00513.91
5.5.90.0030.01014.47
5.5.80.0040.01514.13
5.5.70.0080.01214.11
5.5.60.0070.00314.39
5.5.50.0030.00513.98
5.5.40.0070.00714.36
5.5.30.0040.00714.43
5.5.20.0070.01013.81
5.5.10.0090.00614.38
5.5.00.0030.00914.27

preferences:
64.8 ms | 400 KiB | 5 Q