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.0120.00617.00
8.3.50.0120.00922.05
8.3.40.0140.00018.97
8.3.30.0040.01118.89
8.3.20.0050.00320.25
8.3.10.0040.00423.66
8.3.00.0030.00519.79
8.2.180.0170.00716.75
8.2.170.0120.00322.96
8.2.160.0030.01020.47
8.2.150.0000.00824.18
8.2.140.0070.00024.66
8.2.130.0090.00019.25
8.2.120.0000.00826.35
8.2.110.0070.00322.16
8.2.100.0000.01217.84
8.2.90.0030.00619.23
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0000.00817.93
8.2.50.0070.00418.07
8.2.40.0000.00718.22
8.2.30.0000.00718.19
8.2.20.0080.00017.83
8.2.10.0050.00318.33
8.2.00.0030.00518.13
8.1.280.0060.01225.92
8.1.270.0040.00419.00
8.1.260.0050.00228.09
8.1.250.0050.00328.09
8.1.240.0060.00320.76
8.1.230.0110.00017.83
8.1.220.0060.00317.89
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0090.00018.72
8.1.160.0000.00718.93
8.1.150.0040.00418.96
8.1.140.0040.00419.55
8.1.130.0030.00317.67
8.1.120.0040.00417.52
8.1.110.0000.00817.54
8.1.100.0040.00417.53
8.1.90.0070.00317.57
8.1.80.0000.00817.48
8.1.70.0070.00017.37
8.1.60.0060.00317.64
8.1.50.0040.00417.57
8.1.40.0060.00317.58
8.1.30.0060.00317.61
8.1.20.0050.00317.69
8.1.10.0000.00717.62
8.1.00.0040.00817.63
8.0.300.0040.00418.77
8.0.290.0080.00016.88
8.0.280.0000.00718.50
8.0.270.0040.00416.94
8.0.260.0030.00317.23
8.0.250.0030.00317.04
8.0.240.0030.00316.97
8.0.230.0070.00017.09
8.0.220.0040.00417.01
8.0.210.0000.00817.08
8.0.200.0060.00017.11
8.0.190.0030.00517.06
8.0.180.0000.00716.90
8.0.170.0060.00317.10
8.0.160.0000.00717.02
8.0.150.0080.00016.95
8.0.140.0040.00416.93
8.0.130.0030.00313.47
8.0.120.0070.00016.96
8.0.110.0000.00817.00
8.0.100.0030.00616.91
8.0.90.0030.00516.91
8.0.80.0000.01617.04
8.0.70.0040.00416.96
8.0.60.0030.00516.83
8.0.50.0000.00716.82
8.0.30.0060.01317.27
8.0.20.0100.01017.40
8.0.10.0040.00416.92
8.0.00.0100.00916.92
7.4.330.0000.00516.83
7.4.320.0000.00716.49
7.4.300.0030.00316.47
7.4.290.0000.00716.52
7.4.280.0060.00316.56
7.4.270.0030.00316.48
7.4.260.0000.00716.57
7.4.250.0040.00416.53
7.4.240.0030.00416.60
7.4.230.0000.00716.68
7.4.220.0120.00616.66
7.4.210.0060.00916.74
7.4.200.0040.00416.48
7.4.160.0130.00316.71
7.4.150.0070.01017.40
7.4.140.0080.01417.86
7.4.130.0140.00616.48
7.4.120.0080.00916.66
7.4.110.0100.00716.62
7.4.100.0030.01416.55
7.4.90.0030.01416.43
7.4.80.0090.01419.39
7.4.70.0130.00316.63
7.4.60.0000.01716.39
7.4.50.0070.01016.59
7.4.40.0060.01016.64
7.4.30.0130.01016.68
7.4.00.0070.01015.26
7.3.330.0000.00513.41
7.3.320.0030.00313.41
7.3.310.0030.00316.31
7.3.300.0030.00316.41
7.3.290.0040.00416.29
7.3.280.0090.00716.44
7.3.270.0110.00717.40
7.3.260.0090.00916.52
7.3.250.0130.00616.51
7.3.240.0130.00616.57
7.3.230.0120.00616.47
7.3.210.0030.01916.30
7.3.200.0140.00616.55
7.3.190.0070.01716.66
7.3.180.0100.00716.52
7.3.170.0100.01416.56
7.3.160.0060.00916.55
7.3.120.0030.01414.58
7.3.110.0030.01614.86
7.3.100.0060.01314.84
7.3.90.0150.00014.78
7.3.80.0090.00914.58
7.3.70.0040.01114.55
7.3.60.0030.01014.93
7.3.50.0120.00314.84
7.3.40.0030.00914.70
7.3.30.0120.00414.91
7.3.20.0070.01016.50
7.3.10.0060.00616.34
7.3.00.0070.01016.67
7.2.330.0140.00416.78
7.2.320.0100.00616.53
7.2.310.0090.00916.75
7.2.300.0120.00916.62
7.2.290.0000.01816.81
7.2.250.0060.01315.20
7.2.240.0040.00815.27
7.2.230.0070.00715.26
7.2.220.0070.00315.18
7.2.210.0000.01714.90
7.2.200.0030.00614.88
7.2.190.0000.01714.86
7.2.180.0060.00315.02
7.2.170.0040.00814.96
7.2.160.0130.00015.09
7.2.150.0000.01416.78
7.2.140.0040.01116.49
7.2.130.0110.00417.05
7.2.120.0050.00516.93
7.2.110.0030.01416.92
7.2.100.0090.00616.63
7.2.90.0000.01316.63
7.2.80.0070.00717.05
7.2.70.0030.01317.01
7.2.60.0050.00917.03
7.2.50.0050.00517.08
7.2.40.0060.00917.07
7.2.30.0100.00316.83
7.2.20.0060.00616.77
7.2.10.0070.00716.68
7.2.00.0070.00518.18
7.1.330.0120.00415.68
7.1.320.0070.01015.46
7.1.310.0070.00715.63
7.1.300.0100.00315.62
7.1.290.0040.01115.71
7.1.280.0070.00715.86
7.1.270.0030.01015.87
7.1.260.0000.01015.72
7.1.250.0070.00715.71
7.1.240.0000.01515.71
7.1.230.0060.00315.57
7.1.220.0140.00315.62
7.1.210.0100.00315.66
7.1.200.0060.00715.84
7.1.190.0060.00915.79
7.1.180.0090.00615.83
7.1.170.0070.00715.67
7.1.160.0030.01015.48
7.1.150.0040.00415.67
7.1.140.0110.00415.81
7.1.130.0070.00715.61
7.1.120.0040.01115.84
7.1.110.0030.00615.58
7.1.100.0010.01016.98
7.1.90.0060.00915.77
7.1.80.0140.00415.66
7.1.70.0070.00516.35
7.1.60.0090.00917.67
7.1.50.0070.00816.12
7.1.40.0030.01015.41
7.1.30.0070.00715.57
7.1.20.0080.00415.61
7.1.10.0060.00915.79
7.1.00.0040.04019.17
7.0.330.0060.00615.26
7.0.320.0070.00715.11
7.0.310.0040.01015.31
7.0.300.0000.01115.42
7.0.290.0000.01415.28
7.0.280.0030.01015.16
7.0.270.0060.00915.11
7.0.260.0060.00315.13
7.0.250.0040.00715.39
7.0.240.0030.00815.22
7.0.230.0000.01415.35
7.0.220.0030.01315.30
7.0.210.0030.01215.46
7.0.200.0060.00416.12
7.0.190.0070.00715.59
7.0.180.0070.00715.36
7.0.170.0000.00915.52
7.0.160.0000.01715.39
7.0.150.0030.00915.32
7.0.140.0070.00715.18
7.0.130.0030.01215.25
7.0.120.0040.00915.54
7.0.110.0030.00615.52
7.0.100.0100.00315.46
7.0.90.0050.00515.53
7.0.80.0040.00415.33
7.0.70.0070.00715.45
7.0.60.0030.03017.69
7.0.50.0080.03316.59
7.0.40.0050.04816.64
7.0.30.0240.03716.80
7.0.20.0120.02516.64
7.0.10.0080.04316.77
7.0.00.0120.04316.89
5.6.400.0030.01314.51
5.6.390.0100.00314.17
5.6.380.0100.00714.40
5.6.370.0030.00614.29
5.6.360.0000.00914.45
5.6.350.0120.00014.44
5.6.340.0040.00814.14
5.6.330.0150.00014.70
5.6.320.0040.01113.95
5.6.310.0100.00314.27
5.6.300.0100.00314.38
5.6.290.0060.00613.96
5.6.280.0020.04317.81
5.6.270.0060.00614.44
5.6.260.0000.01414.17
5.6.250.0070.00314.22
5.6.240.0120.00414.28
5.6.230.0030.01014.42
5.6.220.0110.00614.30
5.6.210.0030.03617.36
5.6.200.0070.03216.44
5.6.190.0090.03817.33
5.6.180.0320.03817.38
5.6.170.0150.01817.46
5.6.160.0120.03717.46
5.6.150.0080.02516.29
5.6.140.0050.04016.15
5.6.130.0080.04516.33
5.6.120.0100.03517.56
5.6.110.0160.03717.57
5.6.100.0030.03017.81
5.6.90.0040.02717.63
5.6.80.0070.04217.42
5.6.70.0000.01414.31
5.6.60.0060.00614.07
5.6.50.0120.00414.15
5.6.40.0050.00514.27
5.6.30.0030.01014.00
5.6.20.0030.00914.09
5.6.10.0030.01314.50
5.6.00.0000.01414.50
5.5.380.0090.00314.23
5.5.370.0120.00014.37
5.5.360.0040.00414.20
5.5.350.0030.02317.43
5.5.340.0060.03116.19
5.5.330.0060.04117.34
5.5.320.0070.04217.35
5.5.310.0120.02317.36
5.5.300.0010.02816.23
5.5.290.0110.04115.94
5.5.280.0080.02217.72
5.5.270.0070.03517.46
5.5.260.0080.03317.57
5.5.250.0050.04717.43
5.5.240.0100.04217.17
5.5.230.0040.01214.30
5.5.220.0000.01214.23
5.5.210.0060.00614.31
5.5.200.0070.00714.33
5.5.190.0030.01014.35
5.5.180.0000.01314.04
5.5.170.0060.00614.16
5.5.160.0030.00713.83
5.5.150.0080.00314.41
5.5.140.0070.00314.06
5.5.130.0040.00813.95
5.5.120.0100.00714.00
5.5.110.0060.00614.23
5.5.100.0030.01014.57
5.5.90.0060.00614.34
5.5.80.0090.00913.71
5.5.70.0030.01014.15
5.5.60.0130.00013.94
5.5.50.0040.00414.09
5.5.40.0110.00414.22
5.5.30.0030.00614.12
5.5.20.0030.00713.98
5.5.10.0000.00813.98
5.5.00.0040.00414.11

preferences:
37.17 ms | 401 KiB | 5 Q