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($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.0120.00916.74
8.3.50.0110.01121.30
8.3.40.0110.00418.84
8.3.30.0110.00318.75
8.3.20.0070.00020.33
8.3.10.0040.00421.73
8.3.00.0080.00019.79
8.2.180.0070.01316.50
8.2.170.0070.01022.96
8.2.160.0100.00320.57
8.2.150.0050.00324.18
8.2.140.0120.00624.66
8.2.130.0050.00326.16
8.2.120.0060.00317.63
8.2.110.0090.00022.20
8.2.100.0090.00317.63
8.2.90.0080.00019.13
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0000.00817.93
8.2.50.0060.00318.07
8.2.40.0000.00819.27
8.2.30.0060.00319.72
8.2.20.0000.00717.72
8.2.10.0070.00018.18
8.2.00.0040.00418.03
8.1.280.0070.00725.92
8.1.270.0140.00720.20
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00622.42
8.1.230.0080.00317.42
8.1.220.0000.00817.77
8.1.210.0040.00418.77
8.1.200.0070.00317.35
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0050.00318.36
8.1.160.0080.00022.11
8.1.150.0030.00518.88
8.1.140.0030.00517.37
8.1.130.0050.00217.69
8.1.120.0070.00017.35
8.1.110.0060.00317.34
8.1.100.0070.00017.36
8.1.90.0070.00017.41
8.1.80.0040.00417.37
8.1.70.0030.00317.46
8.1.60.0000.00817.59
8.1.50.0050.00317.51
8.1.40.0030.00717.41
8.1.30.0040.00417.54
8.1.20.0040.00417.65
8.1.10.0030.00617.62
8.1.00.0000.00917.44
8.0.300.0070.00018.77
8.0.290.0000.00716.88
8.0.280.0030.00318.30
8.0.270.0030.00317.25
8.0.260.0060.00017.25
8.0.250.0040.00417.03
8.0.240.0080.00017.02
8.0.230.0000.00817.04
8.0.220.0000.00716.83
8.0.210.0000.00716.85
8.0.200.0000.00616.91
8.0.190.0000.00817.04
8.0.180.0040.00416.86
8.0.170.0040.00416.84
8.0.160.0060.00316.95
8.0.150.0040.00416.81
8.0.140.0070.00416.83
8.0.130.0070.00013.37
8.0.120.0060.00316.84
8.0.110.0000.00716.97
8.0.100.0070.00017.00
8.0.90.0040.00416.94
8.0.80.0130.00717.00
8.0.70.0030.00516.82
8.0.60.0040.00417.06
8.0.50.0040.00416.98
8.0.30.0160.00717.14
8.0.20.0130.00917.40
8.0.10.0020.00516.89
8.0.00.0130.00616.68
7.4.330.0050.00015.09
7.4.320.0030.00316.50
7.4.300.0030.00316.52
7.4.290.0040.00416.57
7.4.280.0000.00716.49
7.4.270.0000.00716.45
7.4.260.0030.00616.43
7.4.250.0070.00016.45
7.4.240.0040.00316.42
7.4.230.0070.00016.70
7.4.220.0070.01016.40
7.4.210.0070.00716.54
7.4.200.0070.00016.67
7.4.160.0090.00616.33
7.4.150.0100.00917.40
7.4.140.0140.01017.86
7.4.130.0140.00616.63
7.4.120.0060.01216.63
7.4.110.0070.01116.54
7.4.100.0100.00716.57
7.4.90.0140.00316.70
7.4.80.0120.00619.39
7.4.70.0030.01316.41
7.4.60.0040.01216.51
7.4.50.0060.00316.63
7.4.40.0060.00916.33
7.4.30.0090.01316.55
7.4.10.0100.00614.77
7.4.00.0040.00914.97
7.3.330.0030.00313.23
7.3.320.0030.00313.41
7.3.310.0070.00016.45
7.3.300.0030.00316.31
7.3.290.0030.00316.30
7.3.280.0060.01116.44
7.3.270.0110.00517.40
7.3.260.0130.00416.38
7.3.250.0130.00716.51
7.3.240.0130.00316.40
7.3.230.0120.00816.61
7.3.210.0100.00716.41
7.3.200.0040.01216.57
7.3.190.0140.00316.47
7.3.180.0060.00916.50
7.3.170.0080.01316.70
7.3.160.0150.00316.37
7.3.130.0100.00714.93
7.3.120.0050.00915.14
7.3.110.0070.01114.91
7.3.100.0030.00915.10
7.3.90.0040.00414.76
7.3.80.0060.00314.77
7.3.70.0040.00814.84
7.3.60.0040.01114.91
7.3.50.0120.00314.84
7.3.40.0000.01114.82
7.3.30.0060.00915.00
7.3.20.0120.00616.72
7.3.10.0150.00316.73
7.3.00.0060.00916.76
7.2.330.0030.01516.68
7.2.320.0110.01116.49
7.2.310.0100.00716.81
7.2.300.0060.01016.69
7.2.290.0190.00316.46
7.2.260.0110.00715.30
7.2.250.0100.01015.04
7.2.240.0030.01214.83
7.2.230.0120.00315.07
7.2.220.0030.01314.78
7.2.210.0060.00614.83
7.2.200.0040.01115.12
7.2.190.0060.00615.14
7.2.180.0030.00715.10
7.2.170.0000.01015.04
7.2.160.0040.00714.96
7.2.150.0120.00617.09
7.2.140.0130.00716.69
7.2.130.0000.01816.98
7.2.120.0030.00916.91
7.2.110.0220.00616.72
7.2.100.0060.00916.82
7.2.90.0040.01116.96
7.2.80.0030.00916.62
7.2.70.0000.01016.71
7.2.60.0080.00516.74
7.2.50.0000.01616.91
7.2.40.0000.01016.71
7.2.30.0060.01217.04
7.2.20.0110.00417.04
7.2.10.0060.00917.01
7.2.00.0050.01318.24
7.1.330.0070.00716.01
7.1.320.0100.00615.87
7.1.310.0030.01016.13
7.1.300.0120.00315.73
7.1.290.0040.00815.77
7.1.280.0070.00415.80
7.1.270.0000.00915.56
7.1.260.0040.01115.86
7.1.250.0060.00615.77
7.1.240.0030.01315.60
7.1.230.0070.00715.94
7.1.220.0100.00015.92
7.1.210.0030.00615.77
7.1.200.0050.00415.55
7.1.190.0100.00315.68
7.1.180.0040.00715.89
7.1.170.0070.00715.63
7.1.160.0100.00315.90
7.1.150.0000.01315.77
7.1.140.0060.00315.95
7.1.130.0070.00315.66
7.1.120.0040.01115.88
7.1.110.0060.00915.83
7.1.100.0130.00816.77
7.1.90.0000.01215.61
7.1.80.0080.00815.80
7.1.70.0060.00516.53
7.1.60.0060.00717.91
7.1.50.0070.00816.44
7.1.40.0100.00615.46
7.1.30.0150.00015.63
7.1.20.0060.00315.83
7.1.10.0060.00615.68
7.1.00.0070.03919.17
7.0.330.0000.01115.61
7.0.320.0080.00015.54
7.0.310.0000.00815.45
7.0.300.0040.00415.39
7.0.290.0030.01315.43
7.0.280.0050.00315.14
7.0.270.0060.00615.38
7.0.260.0030.00715.18
7.0.250.0040.00815.19
7.0.240.0000.01315.21
7.0.230.0030.01015.24
7.0.220.0030.00915.37
7.0.210.0060.00915.43
7.0.200.0010.00616.19
7.0.190.0000.00915.54
7.0.180.0110.00415.08
7.0.170.0110.00415.23
7.0.160.0030.00615.22
7.0.150.0060.00815.31
7.0.140.0000.01415.41
7.0.130.0030.01015.64
7.0.120.0060.00615.34
7.0.110.0070.00715.49
7.0.100.0060.00915.55
7.0.90.0000.01315.43
7.0.80.0090.00615.40
7.0.70.0130.00315.51
7.0.60.0050.04617.78
7.0.50.0060.02316.71
7.0.40.0050.02616.84
7.0.30.0130.04216.94
7.0.20.0150.02116.77
7.0.10.0090.03616.79
7.0.00.0090.04016.77
5.6.400.0060.01214.32
5.6.390.0000.01214.32
5.6.380.0070.00614.11
5.6.370.0030.00614.32
5.6.360.0000.00814.74
5.6.350.0090.00614.44
5.6.340.0050.00513.93
5.6.330.0000.01114.56
5.6.320.0090.00614.32
5.6.310.0090.00614.52
5.6.300.0030.00913.86
5.6.290.0110.00414.36
5.6.280.0030.04217.60
5.6.270.0030.01314.73
5.6.260.0070.00414.39
5.6.250.0030.00814.20
5.6.240.0040.00414.19
5.6.230.0070.00714.49
5.6.220.0130.00014.06
5.6.210.0070.04217.45
5.6.200.0090.03716.23
5.6.190.0080.02517.56
5.6.180.0180.02517.37
5.6.170.0140.04217.38
5.6.160.0040.04417.44
5.6.150.0050.04616.29
5.6.140.0090.02716.27
5.6.130.0030.02516.26
5.6.120.0070.04517.67
5.6.110.0070.04517.78
5.6.100.0050.04717.68
5.6.90.0130.04017.47
5.6.80.0030.04517.43
5.6.70.0080.00814.40
5.6.60.0070.00714.21
5.6.50.0000.01314.30
5.6.40.0070.00714.14
5.6.30.0030.00613.99
5.6.20.0030.00914.29
5.6.10.0080.00814.13
5.6.00.0060.00914.35
5.5.380.0030.00914.32
5.5.370.0070.00713.96
5.5.360.0040.00814.26
5.5.350.0150.02517.42
5.5.340.0070.02916.19
5.5.330.0020.02717.49
5.5.320.0150.02617.38
5.5.310.0220.04017.33
5.5.300.0050.02516.12
5.5.290.0100.04016.19
5.5.280.0110.03517.50
5.5.270.0070.02717.50
5.5.260.0050.04717.62
5.5.250.0090.04017.53
5.5.240.0050.04217.33
5.5.230.0030.01214.39
5.5.220.0040.00714.07
5.5.210.0030.01213.93
5.5.200.0000.01114.11
5.5.190.0040.00714.26
5.5.180.0040.00714.41
5.5.170.0060.00914.10
5.5.160.0030.00914.13
5.5.150.0030.00914.11
5.5.140.0000.01114.49
5.5.130.0060.00814.03
5.5.120.0070.00714.27
5.5.110.0030.01014.41
5.5.100.0060.00613.98
5.5.90.0080.00314.44
5.5.80.0000.01313.98
5.5.70.0070.00714.43
5.5.60.0090.00914.04
5.5.50.0040.00713.73
5.5.40.0140.00314.35
5.5.30.0070.00714.30
5.5.20.0060.00914.33
5.5.10.0060.00614.19
5.5.00.0040.00814.05
5.4.450.0180.03715.13
5.4.440.0270.02815.03
5.4.430.0250.03115.28
5.4.420.0270.02815.33
5.4.410.0270.02715.13
5.4.400.0320.02715.08
5.4.390.0310.02915.07
5.4.380.0300.02815.25
5.4.370.0340.02515.17
5.4.360.0310.02614.94
5.4.350.0300.03015.15
5.4.340.0300.02315.01
5.4.330.0040.00810.82
5.4.320.0240.02814.93
5.4.310.0280.02814.99
5.4.300.0210.03014.75
5.4.290.0200.03214.98
5.4.280.0250.02815.12
5.4.270.0240.02715.20
5.4.260.0290.02715.14
5.4.250.0260.03015.18
5.4.240.0370.02815.23
5.4.230.0280.03515.03
5.4.220.0290.02915.05
5.4.210.0300.03014.84
5.4.200.0270.03114.92
5.4.190.0230.03414.98
5.4.180.0270.03015.03
5.4.170.0300.03115.01
5.4.160.0300.02514.92
5.4.150.0320.02515.11
5.4.140.0250.03313.71
5.4.130.0180.03013.85
5.4.120.0280.02513.68
5.4.110.0250.02813.77
5.4.100.0300.02813.80
5.4.90.0050.03113.68
5.4.80.0050.02813.75
5.4.70.0050.03113.77
5.4.60.0100.03813.89
5.4.50.0070.02913.73
5.4.40.0100.02313.87
5.4.30.0170.02813.83
5.4.20.0070.02813.80
5.4.10.0050.03413.88
5.4.00.0050.03213.43
5.3.290.0170.05314.72
5.3.280.0130.05014.61
5.3.270.0070.06014.62
5.3.260.0130.05014.61
5.3.250.0170.04714.52
5.3.240.0400.07014.47
5.3.230.0230.04314.53
5.3.220.0270.05714.54
5.3.210.0130.05014.44
5.3.200.0430.04714.67
5.3.190.0470.05314.71
5.3.180.0400.05014.59
5.3.170.0130.05714.48
5.3.160.0200.05014.58
5.3.150.0200.06014.62
5.3.140.0530.04314.57
5.3.130.0230.04714.41
5.3.120.0230.04714.57
5.3.110.0070.06014.46
5.3.100.0170.04714.18
5.3.90.0130.05713.93
5.3.80.0100.05314.07
5.3.70.0130.05013.88
5.3.60.0130.05014.15
5.3.50.0200.05013.86
5.3.40.0270.05013.81
5.3.30.0600.06013.81
5.3.20.0400.05313.60
5.3.10.0100.04713.57
5.3.00.0070.05313.66
5.2.170.0170.04711.05
5.2.160.0130.03711.06
5.2.150.0030.04711.07
5.2.140.0100.04011.05
5.2.130.0130.03711.16
5.2.120.0500.04311.02
5.2.110.0200.03311.12
5.2.100.0130.04311.01
5.2.90.0130.04011.11
5.2.80.0100.04311.18
5.2.70.0170.04011.10
5.2.60.0130.04310.91
5.2.50.0130.04311.25
5.2.40.0200.04310.89
5.2.30.0070.04310.88
5.2.20.0100.03710.88
5.2.10.0030.04310.91
5.2.00.0070.04310.65
5.1.60.0130.03010.05
5.1.50.0130.03010.22
5.1.40.0100.03710.04
5.1.30.0030.04010.26
5.1.20.0030.04010.37
5.1.10.0000.04310.32
5.1.00.0200.03010.05
5.0.50.0270.0238.79
5.0.40.0130.0308.35
5.0.30.0230.0378.26
5.0.20.0170.0278.13
5.0.10.0100.0338.25
5.0.00.0130.0338.15
4.4.90.0100.0175.97
4.4.80.0030.0205.97
4.4.70.0000.0235.97
4.4.60.0030.0235.97
4.4.50.0030.0205.97
4.4.40.0070.0305.97
4.4.30.0030.0235.97
4.4.20.0030.0235.97
4.4.10.0030.0235.98
4.4.00.0030.0375.98
4.3.110.0030.0235.98
4.3.100.0030.0205.98
4.3.90.0130.0135.99
4.3.80.0100.0306.00
4.3.70.0070.0176.01
4.3.60.0030.0236.01
4.3.50.0000.0276.02
4.3.40.0030.0336.02
4.3.30.0030.0236.02
4.3.20.0000.0236.02
4.3.10.0000.0236.02
4.3.00.0070.0176.02

preferences:
57.16 ms | 401 KiB | 5 Q