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 = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); $output = base64_encode($output); } else if( $action == 'decrypt' ){ $output = openssl_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.40.0110.00318.84
8.3.30.0060.01120.35
8.3.20.0030.00520.25
8.3.10.0040.00420.98
8.3.00.0000.00822.43
8.2.170.0110.00422.96
8.2.160.0070.00722.26
8.2.150.0110.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0160.00320.75
8.2.110.0090.00019.21
8.2.100.0080.00317.78
8.2.90.0050.00319.13
8.2.80.0040.00417.97
8.2.70.0050.00317.73
8.2.60.0000.00817.80
8.2.50.0030.00618.07
8.2.40.0050.00318.15
8.2.30.0040.00419.49
8.2.20.0050.00217.84
8.2.10.0050.00217.79
8.2.00.0000.00717.76
8.1.270.0100.01023.77
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.54
8.1.230.0070.00420.88
8.1.220.0090.00018.77
8.1.210.0000.00818.92
8.1.200.0040.00417.13
8.1.190.0060.00317.54
8.1.180.0040.00418.10
8.1.170.0000.00818.45
8.1.160.0000.00718.88
8.1.150.0040.00418.48
8.1.140.0030.00617.44
8.1.130.0030.00317.80
8.1.120.0000.00717.36
8.1.110.0000.00717.43
8.1.100.0050.00317.46
8.1.90.0000.00717.50
8.1.80.0030.00317.42
8.1.70.0070.00017.34
8.1.60.0040.00417.63
8.1.50.0000.00817.53
8.1.40.0000.00817.48
8.1.30.0040.00417.64
8.1.20.0030.00517.56
8.1.10.0050.00317.49
8.1.00.0060.00317.36
8.0.300.0000.00819.95
8.0.290.0040.00417.05
8.0.280.0050.00318.43
8.0.270.0040.00417.14
8.0.260.0030.00316.82
8.0.250.0030.00617.04
8.0.240.0040.00417.06
8.0.230.0000.00717.02
8.0.220.0030.00316.93
8.0.210.0070.00016.96
8.0.200.0070.00016.89
8.0.190.0000.00816.88
8.0.180.0000.00716.87
8.0.170.0030.00616.94
8.0.160.0000.00716.93
8.0.150.0070.00016.89
8.0.140.0090.00316.97
8.0.130.0030.00313.38
8.0.120.0040.00416.92
8.0.110.0050.00316.84
8.0.100.0050.00316.90
8.0.90.0070.00017.02
8.0.80.0000.01516.87
8.0.70.0070.00016.82
8.0.60.0000.00716.96
8.0.50.0000.00717.01
8.0.30.0140.00917.01
8.0.20.0120.01017.40
8.0.10.0070.00016.89
8.0.00.0110.01016.80
7.4.330.0050.00016.70
7.4.320.0000.00616.48
7.4.300.0030.00316.48
7.4.290.0070.00016.55
7.4.280.0030.00316.40
7.4.270.0000.00716.61
7.4.260.0000.00613.29
7.4.250.0050.00316.45
7.4.240.0020.00516.47
7.4.230.0030.00316.63
7.4.220.0100.00816.66
7.4.210.0030.01016.58
7.4.200.0000.00716.41
7.4.190.0040.00416.56
7.4.160.0110.00516.48
7.4.150.0100.00717.40
7.4.140.0110.00617.86
7.4.130.0040.01216.58
7.4.120.0090.00916.55
7.4.110.0080.00916.51
7.4.100.0130.00816.57
7.4.90.0090.00916.44
7.4.80.0120.00817.80
7.4.70.0120.00516.43
7.4.60.0070.01116.41
7.4.50.0080.00616.23
7.4.40.0100.00419.41
7.4.30.0070.01116.29
7.4.20.0150.00916.07
7.4.10.0210.01516.22
7.4.00.0100.00916.04
7.3.330.0030.00213.45
7.3.320.0020.00213.37
7.3.310.0000.00816.28
7.3.300.0000.00716.23
7.3.290.0070.00716.47
7.3.280.0100.00616.46
7.3.270.0040.01417.40
7.3.260.0090.00818.24
7.3.250.0160.00816.42
7.3.240.0130.00316.54
7.3.230.0110.00516.61
7.3.220.0070.01116.43
7.3.210.0100.00816.48
7.3.200.0050.01216.50
7.3.190.0070.01116.49
7.3.180.0080.00916.38
7.3.170.0080.00916.39
7.3.160.0120.01016.37
7.3.150.0090.00616.33
7.3.140.0350.01716.17
7.3.130.0180.01516.25
7.3.120.0130.00815.84
7.3.110.0100.00816.26
7.3.100.0110.00516.30
7.3.90.0060.00616.32
7.3.80.0080.00816.37
7.3.70.0050.01116.31
7.3.60.0080.00616.29
7.3.50.0080.01116.22
7.3.40.0110.01315.65
7.3.30.0100.01015.40
7.3.20.0390.00916.18
7.3.10.0350.00816.24
7.3.00.0390.00816.20
7.2.340.0140.00516.77
7.2.330.0060.01116.75
7.2.320.0100.00816.67
7.2.310.0100.00916.52
7.2.300.0070.01316.69
7.2.290.0080.01016.60
7.2.280.0070.01516.39
7.2.270.0410.03116.39
7.2.260.0120.00816.39
7.2.250.0130.01116.46
7.2.240.0110.00616.33
7.2.230.0120.00616.64
7.2.220.0080.01216.40
7.2.210.0140.01116.56
7.2.200.0070.01016.49
7.2.190.0040.01316.62
7.2.180.0040.01316.44
7.2.170.0070.00715.69
7.2.160.0100.00815.53
7.2.150.0500.00916.34
7.2.140.0380.00516.43
7.2.130.0330.00716.51
7.2.120.0320.00916.50
7.2.110.0550.00816.07
7.2.100.0700.00716.07
7.2.90.0490.00516.07
7.2.80.0510.00716.06
7.2.70.0510.00916.18
7.2.60.0430.00816.00
7.2.50.0550.00715.98
7.2.40.0470.00716.08
7.2.30.0520.00816.00
7.2.20.0530.00915.94
7.2.10.0460.00816.06
7.2.00.0560.00716.15
7.1.330.0220.00916.53
7.1.320.0150.00816.58
7.1.310.0130.00816.69
7.1.300.0170.00616.44
7.1.290.0120.01016.50
7.1.280.0130.00615.56
7.1.270.0460.00815.36
7.1.260.0380.00915.31
7.1.250.0330.00815.37
7.1.240.0470.00915.35
7.1.230.0440.00815.08
7.1.220.0600.00715.00
7.1.210.0630.00915.06
7.1.200.0430.00915.17
7.1.190.0420.00715.04
7.1.180.0460.00715.07
7.1.170.0540.00814.90
7.1.160.0470.00715.22
7.1.150.0460.00615.25
7.1.140.0420.00815.31
7.1.130.0540.00815.19
7.1.120.0510.00915.22
7.1.110.0600.00715.14
7.1.100.0440.00715.20
7.1.90.0620.00615.13
7.1.80.0610.00815.25
7.1.70.0440.00915.31
7.1.60.0480.00921.86
7.1.50.0610.00921.73
7.1.40.0500.00821.76
7.1.30.0470.00821.74
7.1.20.0480.00921.69
7.1.10.0290.00715.19
7.1.00.0320.00915.23
7.0.330.0400.00714.55
7.0.320.0420.00914.58
7.0.310.0640.00714.44
7.0.300.0630.00714.31
7.0.290.0550.00914.64
7.0.280.0470.00714.39
7.0.270.0660.00714.62
7.0.260.0580.00914.68
7.0.250.0620.00814.72
7.0.240.0490.01214.71
7.0.230.0780.00914.63
7.0.220.0560.01114.58
7.0.210.0470.00914.51
7.0.200.0480.00914.69
7.0.190.0550.00814.74
7.0.180.0490.00914.65
7.0.170.0450.00914.74
7.0.160.0490.00714.65
7.0.150.0440.00714.70
7.0.140.0370.00714.69
7.0.130.0340.00814.73
7.0.120.0360.00914.67
7.0.110.0360.00814.71
7.0.100.0350.01014.77
7.0.90.0440.00614.73
7.0.80.0610.00814.62
7.0.70.0370.00714.65
7.0.60.0450.00914.65
7.0.50.0380.00914.70
7.0.40.0440.00714.26
7.0.30.0350.00914.38
7.0.20.0310.00714.15
7.0.10.0350.00914.21
7.0.00.0390.00714.16
5.6.400.0120.00814.85
5.6.390.0180.00814.84
5.6.380.0130.00614.55
5.6.370.0150.00514.41
5.6.360.0120.01014.46
5.6.350.0160.00714.44
5.6.340.0160.00614.41
5.6.330.0140.00914.45
5.6.320.0110.01014.50
5.6.310.0140.00814.41
5.6.300.0150.01815.74
5.6.290.0130.01915.82
5.6.280.0140.01815.77
5.6.270.0150.01615.73
5.6.260.0130.02015.71
5.6.250.0130.02015.83
5.6.240.0130.01915.73
5.6.230.0150.01815.75
5.6.220.0130.02215.66
5.6.210.0140.01815.71
5.6.200.0130.02215.76
5.6.190.0120.02015.77
5.6.180.0160.01315.68
5.6.170.0130.01515.73
5.6.160.0150.01615.66
5.6.150.0110.02015.76
5.6.140.0110.01615.75
5.6.130.0130.01715.75
5.6.120.0110.01915.69
5.6.110.0130.01715.67
5.6.100.0110.02015.80
5.6.90.0130.01615.71
5.6.80.0130.01715.51
5.6.70.0120.01815.54
5.6.60.0130.01715.56
5.6.50.0130.01515.55
5.6.40.0110.01715.58
5.6.30.0120.01815.54
5.6.20.0130.01915.60
5.6.10.0120.02015.55
5.6.00.0130.01615.63
5.5.380.0110.01913.83
5.5.370.0140.01613.82
5.5.360.0130.01713.76
5.5.350.0100.01813.86
5.5.340.0100.01913.98
5.5.330.0130.01713.93
5.5.320.0110.01613.89
5.5.310.0120.01813.87
5.5.300.0110.01713.96
5.5.290.0140.01713.98
5.5.280.0110.01913.92
5.5.270.0120.01613.87
5.5.260.0130.01713.85
5.5.250.0120.01513.80
5.5.240.0110.01613.68
5.5.230.0100.01913.70
5.5.220.0110.01813.73
5.5.210.0120.01713.68
5.5.200.0140.01413.70
5.5.190.0130.01513.56
5.5.180.0100.02013.73
5.5.170.0140.00813.86
5.5.160.0120.01913.79
5.5.150.0100.01813.83
5.5.140.0130.01413.68
5.5.130.0120.01613.60
5.5.120.0130.02013.79
5.5.110.0130.01813.71
5.5.100.0130.01613.76
5.5.90.0120.01613.77
5.5.80.0090.01813.72
5.5.70.0110.01613.63
5.5.60.0100.01713.71
5.5.50.0120.01413.70
5.5.40.0120.01413.71
5.5.30.0130.01513.63
5.5.20.0120.01513.72
5.5.10.0120.01513.63
5.5.00.0110.01813.63
5.4.450.0100.01713.05
5.4.440.0110.01813.09
5.4.430.0110.01413.08
5.4.420.0100.01513.02
5.4.410.0120.01212.99
5.4.400.0110.01512.94
5.4.390.0110.01513.03
5.4.380.0090.01612.96
5.4.370.0090.01512.89
5.4.360.0100.01612.98
5.4.350.0120.01212.93
5.4.340.0110.01612.95
5.4.330.0110.00611.33
5.4.320.0090.01412.99
5.4.310.0110.01512.92
5.4.300.0140.01512.95
5.4.290.0090.01612.99
5.4.280.0120.02012.96
5.4.270.0060.01912.95
5.4.260.0100.01612.91
5.4.250.0100.01512.98
5.4.240.0120.01512.93
5.4.230.0100.01513.00
5.4.220.0090.01312.95
5.4.210.0110.01312.92
5.4.200.0100.01413.00
5.4.190.0100.01312.95
5.4.180.0110.01312.91
5.4.170.0090.01612.98
5.4.160.0120.01512.93
5.4.150.0100.01412.96
5.4.140.0100.01612.46
5.4.130.0090.01512.49
5.4.120.0100.01412.50
5.4.110.0100.01512.51
5.4.100.0090.01412.40
5.4.90.0110.01312.38
5.4.80.0100.01612.45
5.4.70.0100.01612.49
5.4.60.0110.01612.41
5.4.50.0100.01412.44
5.4.40.0110.01412.46
5.4.30.0110.01312.50
5.4.20.0080.01612.50
5.4.10.0130.01512.44
5.4.00.0070.01412.35
5.3.290.0120.01511.99
5.3.280.0100.01211.85
5.3.270.0100.01411.90
5.3.260.0110.01511.90
5.3.250.0080.01811.93
5.3.240.0100.01611.86
5.3.230.0090.01511.93
5.3.220.0100.01311.87
5.3.210.0090.01611.82
5.3.200.0090.01411.87
5.3.190.0100.01511.87
5.3.180.0080.01612.00
5.3.170.0110.01411.97
5.3.160.0090.01611.88
5.3.150.0110.01311.95
5.3.140.0100.01511.91
5.3.130.0090.01511.91
5.3.120.0100.01711.93
5.3.110.0100.01411.92
5.3.100.0080.01511.84
5.3.90.0110.01611.96
5.3.80.0100.01611.85
5.3.70.0080.01411.80
5.3.60.0110.01311.86
5.3.50.0120.01311.85
5.3.40.0100.01711.85
5.3.30.0080.01411.90
5.3.20.0090.01311.76
5.3.10.0090.01511.72
5.3.00.0120.01511.64
5.2.170.0080.01311.21
5.2.160.0080.01411.21
5.2.150.0070.01411.19
5.2.140.0070.01511.16
5.2.130.0070.01311.20
5.2.120.0060.01211.17
5.2.110.0080.01311.20
5.2.100.0070.01311.16
5.2.90.0100.01111.15
5.2.80.0110.01111.15
5.2.70.0090.01311.15
5.2.60.0060.01311.17
5.2.50.0060.01511.18
5.2.40.0080.01211.18
5.2.30.0110.01211.17
5.2.20.0070.01211.12
5.2.10.0090.01411.14
5.2.00.0100.01111.12
5.1.60.0070.01010.99
5.1.50.0070.01111.00
5.1.40.0080.01210.98
5.1.30.0060.01511.04
5.1.20.0060.01211.04
5.1.10.0080.00910.99
5.1.00.0070.01110.99
5.0.50.0090.00810.84
5.0.40.0050.00810.83
5.0.30.0050.01310.80
5.0.20.0070.00810.77
5.0.10.0050.01010.80
5.0.00.0030.01410.80
4.4.90.0050.00710.71
4.4.80.0050.00810.71
4.4.70.0040.00810.71
4.4.60.0040.00710.71
4.4.50.0050.00710.71
4.4.40.0030.01410.71
4.4.30.0030.00810.71
4.4.20.0050.00710.71
4.4.10.0060.00610.71
4.4.00.0040.01110.71
4.3.110.0040.00810.71
4.3.100.0050.00710.71
4.3.90.0040.00710.71
4.3.80.0050.00910.71
4.3.70.0050.00710.71
4.3.60.0040.00710.71
4.3.50.0050.00810.71
4.3.40.0040.01010.71
4.3.30.0040.00710.71
4.3.20.0020.00810.71
4.3.10.0030.00810.71
4.3.00.0030.00710.71

preferences:
39.57 ms | 400 KiB | 5 Q