3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt_decrypt($action, $string) { $output = false; $encrypt_method = "MCRYPT_MODE_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($string, $encrypt_method, $key, 0, $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.75
8.3.50.0070.00716.38
8.3.40.0110.00418.63
8.3.30.0120.00318.84
8.3.20.0090.00020.20
8.3.10.0070.00021.76
8.3.00.0050.00319.56
8.2.180.0110.00718.06
8.2.170.0120.00322.96
8.2.160.0000.01320.52
8.2.150.0000.00824.18
8.2.140.0070.00724.66
8.2.130.0080.00026.16
8.2.120.0060.00317.50
8.2.110.0030.00622.13
8.2.100.0040.00817.75
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0030.00517.60
8.2.60.0050.00317.93
8.2.50.0040.00418.07
8.2.40.0040.00419.29
8.2.30.0040.00419.76
8.2.20.0000.00717.80
8.2.10.0080.00018.01
8.2.00.0050.00218.03
8.1.280.0130.00725.92
8.1.270.0110.00420.23
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0030.00622.50
8.1.230.0090.00317.42
8.1.220.0040.00417.77
8.1.210.0000.00818.77
8.1.200.0060.00317.23
8.1.190.0090.00017.25
8.1.180.0060.00318.10
8.1.170.0050.00318.65
8.1.160.0070.00022.00
8.1.150.0070.00018.80
8.1.140.0060.00317.36
8.1.130.0030.00317.73
8.1.120.0000.00717.46
8.1.110.0040.00417.34
8.1.100.0000.00717.43
8.1.90.0040.00417.49
8.1.80.0060.00317.48
8.1.70.0000.00717.43
8.1.60.0060.00317.64
8.1.50.0050.00317.50
8.1.40.0080.00417.40
8.1.30.0050.00317.63
8.1.20.0070.00017.63
8.1.10.0040.00417.54
8.1.00.0040.00417.42
8.0.300.0060.00318.77
8.0.290.0040.00416.75
8.0.280.0070.00018.38
8.0.270.0030.00317.22
8.0.260.0000.00817.32
8.0.250.0040.00416.92
8.0.240.0030.00317.02
8.0.230.0000.00716.87
8.0.220.0030.00317.00
8.0.210.0030.00617.03
8.0.200.0070.00017.04
8.0.190.0050.00216.95
8.0.180.0000.00717.02
8.0.170.0040.00416.92
8.0.160.0050.00316.96
8.0.150.0040.00416.96
8.0.140.0030.00716.95
8.0.130.0000.00613.31
8.0.120.0080.00016.81
8.0.110.0080.00017.01
8.0.100.0040.00417.02
8.0.90.0040.00316.85
8.0.80.0120.00616.89
8.0.70.0060.00317.04
8.0.60.0000.00716.92
8.0.50.0000.00817.01
8.0.30.0100.00817.35
8.0.20.0090.00917.40
8.0.10.0040.00417.10
8.0.00.0110.00817.05
7.4.330.0020.00215.08
7.4.320.0000.00616.61
7.4.300.0000.00616.49
7.4.290.0000.00716.50
7.4.280.0030.00616.42
7.4.270.0000.00716.41
7.4.260.0070.00016.47
7.4.250.0080.00016.45
7.4.240.0060.00216.55
7.4.230.0030.00316.31
7.4.220.0060.01216.44
7.4.210.0120.00516.55
7.4.200.0030.00316.67
7.4.160.0100.01016.71
7.4.150.0040.01217.40
7.4.140.0100.01017.86
7.4.130.0150.00716.50
7.4.120.0110.00616.69
7.4.110.0140.00316.43
7.4.100.0100.01016.61
7.4.90.0060.01016.58
7.4.80.0100.01319.39
7.4.70.0130.00316.59
7.4.60.0090.00916.57
7.4.50.0050.00316.49
7.4.40.0060.00916.38
7.4.30.0090.01216.39
7.4.00.0110.00314.85
7.3.330.0000.00613.39
7.3.320.0050.00013.39
7.3.310.0030.00316.48
7.3.300.0000.00716.44
7.3.290.0030.00316.48
7.3.280.0140.00216.37
7.3.270.0280.00617.40
7.3.260.0090.00816.40
7.3.250.0100.00816.50
7.3.240.0110.01116.62
7.3.230.0070.01316.39
7.3.210.0030.01316.40
7.3.200.0070.01016.43
7.3.190.0080.00816.42
7.3.180.0110.00416.31
7.3.170.0100.01016.43
7.3.160.0110.00916.60
7.3.120.0070.00715.09
7.3.110.0070.01014.88
7.3.100.0100.00714.89
7.3.90.0150.00015.06
7.3.80.0030.00614.80
7.3.70.0100.00714.76
7.3.60.0040.00714.96
7.3.50.0090.00614.53
7.3.40.0060.00914.91
7.3.30.0090.00314.70
7.3.20.0000.01416.55
7.3.10.0070.00716.50
7.3.00.0030.01016.70
7.2.330.0090.01016.79
7.2.320.0130.01316.38
7.2.310.0110.00816.86
7.2.300.0080.00816.86
7.2.290.0120.00616.75
7.2.240.0000.01515.16
7.2.230.0130.00015.21
7.2.220.0030.00914.79
7.2.210.0040.01114.83
7.2.200.0060.00615.19
7.2.190.0090.00615.17
7.2.180.0100.01015.09
7.2.170.0110.00715.16
7.2.160.0060.01215.15
7.2.150.0030.01016.84
7.2.140.0000.01316.82
7.2.130.0090.00616.93
7.2.120.0070.01116.91
7.2.110.0090.00616.93
7.2.100.0060.01316.98
7.2.90.0060.01016.75
7.2.80.0030.01317.07
7.2.70.0150.00416.97
7.2.60.0050.00916.90
7.2.50.0060.00617.00
7.2.40.0070.00716.96
7.2.30.0080.00816.99
7.2.20.0030.01016.83
7.2.10.0130.00316.87
7.2.00.0050.00618.12
7.1.330.0070.01115.73
7.1.320.0100.00715.68
7.1.310.0090.00315.93
7.1.300.0000.01115.82
7.1.290.0090.00615.77
7.1.280.0000.01215.41
7.1.270.0000.01315.64
7.1.260.0060.00915.51
7.1.250.0040.01215.75
7.1.200.0100.00015.50
7.1.100.0070.00718.38
7.1.70.0070.00317.22
7.1.60.0070.01320.03
7.1.50.0070.01017.07
7.1.00.0100.07022.33
7.0.200.0040.00816.79
7.0.60.0130.07719.95
7.0.50.0070.04017.96
7.0.40.0130.03720.21
7.0.30.0200.04320.25
7.0.20.0300.05020.06
7.0.10.0100.03720.09
7.0.00.0070.04720.30
5.6.280.0070.02721.11
5.6.210.0030.06720.55
5.6.200.0100.08718.13
5.6.190.0070.05020.64
5.6.180.0470.08020.46
5.6.170.0130.04320.71
5.6.160.0100.05320.44
5.6.150.0100.07718.19
5.6.140.0030.08718.18
5.6.130.0070.08318.24
5.6.120.0170.07321.13
5.6.110.0070.08321.02
5.6.100.0030.06721.04
5.6.90.0070.07020.98
5.6.80.0170.07020.42
5.5.350.0230.04320.39
5.5.340.0070.03317.94
5.5.330.0030.05720.27
5.5.320.0200.04020.38
5.5.310.0330.06720.36
5.5.300.0070.08017.98
5.5.290.0100.07718.14
5.5.280.0030.09020.87
5.5.270.0100.08320.77
5.5.260.0100.07720.91
5.5.250.0200.07720.63
5.5.240.0130.06720.25
5.4.450.0170.06019.17
5.4.440.0200.06019.38
5.4.430.0200.05319.37
5.4.420.0200.05019.59
5.4.410.0200.04719.00
5.4.400.0270.06319.05
5.4.390.0270.05019.00
5.4.380.0130.05719.16
5.4.370.0170.05019.06
5.4.360.0200.05019.21
5.4.350.0130.05719.21
5.4.340.0200.05019.16
5.4.320.0200.05319.00
5.4.310.0200.05019.05
5.4.300.0270.04019.05
5.4.290.0130.05319.07
5.4.280.0200.05319.21
5.4.270.0200.05019.27
5.4.260.0130.05718.80
5.4.250.0200.05318.77
5.4.240.0270.04019.22
5.4.230.0100.06718.97
5.4.220.0170.06019.04
5.4.210.0230.04719.16
5.4.200.0230.05019.21
5.4.190.0200.04718.98
5.4.180.0170.04719.04
5.4.170.0100.06019.05
5.4.160.0170.06019.07
5.4.150.0130.05318.79
5.4.140.0200.04716.40
5.4.130.0230.04316.51
5.4.120.0130.05016.55
5.4.110.0170.05016.48
5.4.100.0170.05016.62
5.4.90.0330.03716.62
5.4.80.0230.04016.61
5.4.70.0330.06316.24
5.4.60.0200.05316.43
5.4.50.0030.04316.19
5.4.40.0270.03316.53
5.4.30.0000.07316.64
5.4.20.0270.06716.42
5.4.10.0270.05016.50

preferences:
59.64 ms | 400 KiB | 5 Q