3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt_decrypt($action, $string) { $output = false; $encrypt_method = "AES-256-CBC"; $secret_key = 'This is my secret key'; $secret_iv = 'This is my secret iv'; // hash $key = hash('sha256', $secret_key); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr(hash('sha256', $secret_iv), 0, 16); if( $action == 'encrypt' ) { $output = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_CBC, $iv); $output = base64_encode($output); } else if( $action == 'decrypt' ){ $output = mcrypt_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv); } return $output; } $plain_txt = "This is my plain text"; echo "Plain Text = $plain_txt\n"; $encrypted_txt = encrypt_decrypt('encrypt', $plain_txt); echo "Encrypted Text = $encrypted_txt\n"; $decrypted_txt = encrypt_decrypt('decrypt', $encrypted_txt); echo "Decrypted Text = $decrypted_txt\n"; if( $plain_txt === $decrypted_txt ) echo "SUCCESS"; else echo "FAILED"; echo "\n";

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.0100.01016.63
8.3.50.0140.00621.26
8.3.40.0110.00718.71
8.3.30.0100.00318.91
8.3.20.0000.00720.16
8.3.10.0040.00421.77
8.3.00.0040.00419.79
8.2.180.0110.00716.73
8.2.170.0060.01222.96
8.2.160.0100.00320.47
8.2.150.0060.00324.18
8.2.140.0000.00724.66
8.2.130.0050.00326.16
8.2.120.0040.00417.75
8.2.110.0000.01022.20
8.2.100.0060.00617.91
8.2.90.0050.00317.84
8.2.80.0050.00319.33
8.2.70.0080.00017.63
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0040.00419.25
8.2.30.0030.00519.72
8.2.20.0000.00917.82
8.2.10.0000.00718.18
8.2.00.0050.00218.10
8.1.280.0060.00825.92
8.1.270.0090.00920.32
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00322.15
8.1.230.0080.00420.91
8.1.220.0040.00417.76
8.1.210.0090.00018.77
8.1.200.0000.01017.22
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0030.00618.36
8.1.160.0040.00422.06
8.1.150.0020.00518.84
8.1.140.0030.00517.45
8.1.130.0030.00317.57
8.1.120.0000.00717.33
8.1.110.0060.00317.34
8.1.100.0000.00717.53
8.1.90.0000.00717.38
8.1.80.0030.00517.41
8.1.70.0030.00317.47
8.1.60.0040.00417.55
8.1.50.0030.00617.52
8.1.40.0040.00717.39
8.1.30.0060.00317.58
8.1.20.0030.00617.50
8.1.10.0040.00417.51
8.1.00.0060.00317.34
8.0.300.0050.00319.96
8.0.290.0070.00016.88
8.0.280.0000.00718.45
8.0.270.0070.00017.17
8.0.260.0030.00317.14
8.0.250.0050.00317.01
8.0.240.0030.00317.00
8.0.230.0070.00017.00
8.0.220.0000.00716.95
8.0.210.0030.00416.95
8.0.200.0000.00716.87
8.0.190.0070.00017.02
8.0.180.0000.00716.94
8.0.170.0040.00416.93
8.0.160.0040.00416.87
8.0.150.0000.00816.86
8.0.140.0070.00316.82
8.0.130.0030.00313.31
8.0.120.0040.00416.95
8.0.110.0040.00416.93
8.0.100.0050.00316.93
8.0.90.0050.00216.96
8.0.80.0000.01616.96
8.0.70.0000.00916.82
8.0.60.0000.00716.80
8.0.50.0040.00416.98
8.0.30.0110.00517.11
8.0.20.0070.01317.40
8.0.10.0000.00717.14
8.0.00.0130.00816.78
7.4.330.0000.00515.08
7.4.320.0030.00316.63
7.4.300.0000.00616.54
7.4.290.0050.00316.52
7.4.280.0030.00516.44
7.4.270.0030.00616.45
7.4.260.0030.00316.50
7.4.250.0000.00716.54
7.4.240.0000.00716.50
7.4.230.0030.00316.61
7.4.220.0110.00616.63
7.4.210.0080.01016.55
7.4.200.0040.00416.64
7.4.160.0040.01216.50
7.4.150.0110.00617.40
7.4.140.0120.00717.86
7.4.130.0090.01016.44
7.4.120.0090.00816.44
7.4.110.0140.00416.47
7.4.100.0160.00316.40
7.4.90.0040.01916.46
7.4.80.0150.00419.39
7.4.70.0100.00716.45
7.4.60.0060.00916.55
7.4.50.0030.00516.22
7.4.40.0080.00816.40
7.4.30.0140.00916.58
7.4.00.0100.00714.76
7.3.330.0020.00213.45
7.3.320.0050.00013.42
7.3.310.0050.00316.48
7.3.300.0000.00716.24
7.3.290.0070.00016.45
7.3.280.0120.00716.43
7.3.270.0120.00817.40
7.3.260.0130.00716.62
7.3.250.0080.00916.41
7.3.240.0140.00616.39
7.3.230.0110.00616.45
7.3.210.0090.00816.45
7.3.200.0180.00016.50
7.3.190.0110.00616.64
7.3.180.0070.00716.45
7.3.170.0100.00716.50
7.3.160.0090.00616.46
7.3.10.0030.00916.73
7.3.00.0100.00316.92
7.2.330.0150.00316.74
7.2.320.0140.00716.78
7.2.310.0100.00616.37
7.2.300.0140.00716.66
7.2.290.0110.00816.72
7.2.130.0070.00717.01
7.2.120.0060.01216.81
7.2.110.0170.00316.58
7.2.100.0070.00716.97
7.2.90.0060.00916.94
7.2.80.0090.00616.93
7.2.70.0100.00316.47
7.2.60.0030.01016.79
7.2.50.0030.00717.00
7.2.40.0030.01016.82
7.2.30.0000.01416.98
7.2.20.0060.00916.79
7.2.10.0090.00316.71
7.2.00.0050.00918.19
7.1.250.0080.00515.54
7.1.200.0070.00715.92
7.1.100.0050.00318.20
7.1.70.0030.00516.93
7.1.60.0090.01620.03
7.1.50.0030.01617.07
7.1.00.0030.07722.31
7.0.200.0060.00316.80
7.0.60.0030.04720.11
7.0.50.0030.05718.04
7.0.40.0100.08720.09
7.0.30.0300.05020.10
7.0.20.0270.05020.29
7.0.10.0030.04320.07
7.0.00.0070.04020.29
5.6.280.0070.03020.81
5.6.210.0030.07320.54
5.6.200.0070.06318.19
5.6.190.0100.04020.52
5.6.180.0000.05720.64
5.6.170.0270.07320.59
5.6.160.0130.07020.54
5.6.150.0070.08318.29
5.6.140.0030.04318.19
5.6.130.0100.05318.17
5.6.120.0100.09321.09
5.6.110.0070.08721.09
5.6.100.0030.04021.02
5.6.90.0030.08321.06
5.6.80.0070.08320.48
5.6.70.3600.03320.41
5.5.350.0400.05320.38
5.5.340.0100.07317.99
5.5.330.0030.08020.48
5.5.320.0070.04020.36
5.5.310.0270.04020.21
5.5.300.0000.04317.97
5.5.290.0000.08717.95
5.5.280.0030.05020.96
5.5.270.0030.04720.68
5.5.260.0070.07020.70
5.5.250.0100.06320.63
5.5.240.0170.07320.23
5.4.450.0530.05319.40
5.4.440.0530.05019.34
5.4.430.0470.07019.56
5.4.420.0430.05719.54
5.4.410.0500.05019.52
5.4.400.0800.06318.82
5.4.390.0800.05019.23
5.4.380.0500.05019.07
5.4.370.0670.04319.29
5.4.360.0570.05719.07
5.4.350.0500.04719.05
5.4.340.0500.05019.01
5.4.320.0700.05019.22
5.4.310.0500.04718.82
5.4.300.0500.05319.28
5.4.290.0500.05019.14
5.4.280.0530.07019.26
5.4.270.0570.05319.30
5.4.260.0600.05319.16
5.4.250.0400.06019.14
5.4.240.0670.04319.06
5.4.230.0600.05319.00
5.4.220.0600.05319.28
5.4.210.0500.06019.04
5.4.200.0530.05719.06
5.4.190.0670.04719.05
5.4.180.0800.06319.25
5.4.170.0630.06019.05
5.4.160.0600.07319.02
5.4.150.0100.07719.24
5.4.140.0170.06316.41
5.4.130.0100.05016.59
5.4.120.0300.05316.34
5.4.110.0530.05716.38
5.4.100.0600.05016.68
5.4.90.0570.05016.65
5.4.80.0530.05316.57
5.4.70.0270.04716.63
5.4.60.0270.02716.33
5.4.50.0100.06016.40
5.4.40.0000.04316.57
5.4.30.0070.03316.65
5.4.20.0030.07016.61

preferences:
62.19 ms | 401 KiB | 5 Q