3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "secret"; function getKey($seed='no seed??') { return hash('sha256', $seed, 1); } function encrypt($key, $string) { $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($size, MCRYPT_RAND); $encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_CBC, $iv); return base64_encode($iv . $encrypted_string); } function decrypt($key, $encoded_string) { $binary = base64_decode($encoded_string); $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); $iv = substr($binary, 0, $size); $encrypted_string = substr($binary, $size); return mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encrypted_string, MCRYPT_MODE_CBC, $iv); } $key = getKey('Some Secret String'); $encrypted = encrypt($key, 'This is a string that will be encrypted'); echo decrypt($key, $encrypted);

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.0060.00918.71
8.3.30.0070.00719.09
8.3.20.0050.00220.27
8.3.10.0000.00822.04
8.3.00.0040.00422.46
8.2.170.0100.00722.96
8.2.160.0030.01019.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0030.00619.36
8.2.110.0060.00319.30
8.2.100.0110.00017.91
8.2.90.0040.00419.23
8.2.80.0040.00417.97
8.2.70.0080.00017.50
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0120.00018.09
8.2.30.0040.00418.10
8.2.20.0000.00817.66
8.2.10.0040.00417.77
8.2.00.0000.00817.77
8.1.270.0060.00322.10
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00621.24
8.1.230.0110.00017.45
8.1.220.0080.00017.74
8.1.210.0080.00018.77
8.1.200.0040.00717.22
8.1.190.0040.00417.36
8.1.180.0050.00218.69
8.1.170.0060.00618.66
8.1.160.0050.00222.10
8.1.150.0000.00818.60
8.1.140.0030.00617.41
8.1.130.0030.00317.90
8.1.120.0040.00317.44
8.1.110.0020.00417.33
8.1.100.0030.00417.46
8.1.90.0070.00017.46
8.1.80.0000.00717.41
8.1.70.0030.00317.36
8.1.60.0080.00417.62
8.1.50.0040.00417.56
8.1.40.0050.00317.57
8.1.30.0000.00717.67
8.1.20.0040.00417.67
8.1.10.0030.00617.59
8.1.00.0030.00617.50
8.0.300.0000.00718.77
8.0.290.0000.00816.75
8.0.280.0080.00018.48
8.0.270.0030.00317.32
8.0.260.0050.00316.86
8.0.250.0030.00316.86
8.0.240.0040.00416.96
8.0.230.0000.00717.02
8.0.220.0000.00716.76
8.0.210.0030.00316.92
8.0.200.0040.00417.04
8.0.190.0000.00717.00
8.0.180.0040.00416.98
8.0.170.0080.00016.91
8.0.160.0080.00016.78
8.0.150.0000.00816.86
8.0.140.0000.00716.78
8.0.130.0070.00013.34
8.0.120.0030.00616.77
8.0.110.0000.00716.75
8.0.100.0040.00416.77
8.0.90.0040.00416.86
8.0.80.0130.01016.82
8.0.70.0030.00516.86
8.0.60.0000.00716.92
8.0.50.0050.00316.98
8.0.30.0110.00717.23
8.0.20.0150.00317.40
8.0.10.0000.00717.10
8.0.00.0080.01016.76
7.4.330.0070.00015.00
7.4.320.0030.00316.48
7.4.300.0030.00316.58
7.4.290.0000.00716.55
7.4.280.0080.00016.66
7.4.270.0030.00316.54
7.4.260.0030.00316.48
7.4.250.0050.00316.47
7.4.240.0020.00616.49
7.4.230.0070.00016.46
7.4.220.0150.00316.67
7.4.210.0050.01016.59
7.4.200.0000.00716.33
7.4.190.0000.01116.52
7.4.160.0130.00316.60
7.4.150.0120.00617.40
7.4.140.0100.00817.86
7.4.130.0100.00716.49
7.4.120.0080.01016.61
7.4.110.0060.01616.57
7.4.100.0090.00916.48
7.4.90.0150.01016.71
7.4.80.0090.01219.39
7.4.70.0160.00016.44
7.4.60.0060.01016.61
7.4.50.0000.00716.45
7.4.40.0060.01222.77
7.4.30.0000.01516.48
7.4.00.0100.00714.98
7.3.330.0000.00613.29
7.3.320.0030.00313.33
7.3.310.0030.00316.29
7.3.300.0000.00616.27
7.3.290.0030.01016.30
7.3.280.0080.00716.30
7.3.270.0060.01217.40
7.3.260.0110.00716.32
7.3.250.0100.00716.49
7.3.240.0030.01416.35
7.3.230.0130.00316.57
7.3.210.0120.00416.35
7.3.200.0140.00719.39
7.3.190.0090.01316.47
7.3.180.0070.01016.35
7.3.170.0090.00816.32
7.3.160.0060.00916.53
7.3.120.0000.01314.88
7.3.10.0050.00516.64
7.3.00.0030.00516.38
7.2.330.0070.01116.48
7.2.320.0090.00916.40
7.2.310.0030.01516.64
7.2.300.0130.00316.40
7.2.290.0170.00716.47
7.2.130.0030.00716.64
7.2.120.0030.01216.91
7.2.110.0070.00716.55
7.2.100.0030.00916.55
7.2.90.0090.00616.55
7.2.80.0060.00316.78
7.2.70.0130.00616.51
7.2.60.0080.00616.76
7.2.50.0130.00316.84
7.2.40.0060.00616.82
7.2.30.0040.00816.69
7.2.20.0000.01316.59
7.2.10.0050.00516.57
7.2.00.0060.00818.14
7.1.250.0100.00715.39
7.1.200.0040.00715.48
7.1.100.0150.00018.02
7.1.70.0000.00716.84
7.1.60.0070.01719.82
7.1.50.0030.02017.05
7.1.00.0030.04722.25
7.0.200.0030.00716.90
7.0.140.0030.07322.12
7.0.70.4470.03719.98
7.0.60.0100.07319.81
7.0.50.0030.04017.98
7.0.40.0130.04020.12
7.0.30.0170.06320.18
7.0.20.0330.06720.24
7.0.10.0330.05020.31
7.0.00.0230.07720.24
5.6.280.0100.06721.09
5.6.210.0070.08720.62
5.6.200.0100.07318.23
5.6.190.0100.08020.73
5.6.180.0230.06320.34
5.6.170.0370.06020.62
5.6.160.0130.07320.49
5.6.150.0000.04318.29
5.6.140.0030.04718.20
5.6.130.0030.07318.20
5.6.120.0100.08021.06
5.6.110.0070.03720.98
5.6.100.0070.07021.17
5.6.90.0130.08021.07
5.6.80.0070.04020.45
5.6.70.0170.08320.53
5.5.350.0130.07720.29
5.5.340.0130.07717.99
5.5.330.0000.09320.30
5.5.320.0070.03720.62
5.5.310.0230.07720.35
5.5.300.0030.04318.09
5.5.290.0070.04017.98
5.5.280.0100.07320.74
5.5.270.0000.04320.73
5.5.260.0130.08020.90
5.5.250.0030.08720.71
5.5.240.0000.04720.20
5.4.450.0500.05319.67
5.4.440.0970.05019.50
5.4.430.0930.05019.45
5.4.420.0170.05019.22
5.4.410.0130.05019.36
5.4.400.0900.05719.42
5.4.390.0930.05719.17
5.4.380.0300.04318.67
5.4.370.0330.04018.66
5.4.360.0370.05318.76
5.4.350.0050.03612.02
5.4.340.0040.03612.02
5.4.320.0070.04212.51
5.4.310.0050.03712.51
5.4.300.0060.03512.51
5.4.290.0110.03712.51
5.4.280.0030.03712.41
5.4.270.0060.03512.41
5.4.260.0130.05718.79
5.4.250.0170.07018.83
5.4.240.0130.05018.84
5.4.230.0100.06718.85
5.4.220.0030.06319.01
5.4.210.0200.06018.85
5.4.200.0000.05718.79
5.4.190.0130.07718.97
5.4.180.0170.04318.78
5.4.170.0100.07719.02
5.4.160.0170.07019.04
5.4.150.0170.05018.68
5.4.140.0030.08016.67
5.4.130.0070.05016.49
5.4.120.0230.05716.66
5.4.110.0070.06016.61
5.4.100.0070.05316.58
5.4.90.0100.04716.59
5.4.80.0130.05016.57
5.4.70.0100.07016.55
5.4.60.0130.05716.50
5.4.50.0030.05016.54
5.4.40.0030.05016.53
5.4.30.0030.05316.47
5.4.20.0100.04716.48
5.4.10.0100.06716.44
5.4.00.0030.05015.92
5.3.290.0100.03612.80
5.3.280.0130.04714.77
5.3.270.0070.05714.60
5.3.260.0100.05314.58
5.3.250.0000.06014.70
5.3.240.0070.07014.70
5.3.230.0130.04714.68
5.3.220.0100.05014.71
5.3.210.0130.07314.74
5.3.200.0130.06014.66
5.3.190.0100.05314.57
5.3.180.0100.07014.71
5.3.170.0000.06014.55
5.3.160.0100.06714.63
5.3.150.0100.06714.64
5.3.140.0070.05014.74
5.3.130.0170.04714.58
5.3.120.0070.05714.46
5.3.110.0070.05314.56
5.3.100.0000.05314.05
5.3.90.0000.05714.03
5.3.80.0030.05314.11
5.3.70.0070.07014.00
5.3.60.0130.04014.08
5.3.50.0070.05014.03
5.3.40.0070.05013.88
5.3.30.0070.04714.00
5.3.20.0130.04013.61
5.3.10.0070.04713.73
5.3.00.0100.06713.71
5.2.170.0030.04310.98
5.2.160.0000.04311.14
5.2.150.0100.05011.26
5.2.140.0100.03311.14
5.2.130.0070.04011.29
5.2.120.0070.03710.95
5.2.110.0030.04011.19
5.2.100.0030.06011.11
5.2.90.0170.03311.24
5.2.80.0100.04011.09
5.2.70.0070.04011.19
5.2.60.0070.04011.05
5.2.50.0000.04311.16
5.2.40.0030.05011.11
5.2.30.0070.03711.06
5.2.20.0070.03711.04
5.2.10.0130.03310.86
5.2.00.0070.04710.91
5.1.60.0170.03310.00
5.1.50.0000.03710.07
5.1.40.0070.03010.05
5.1.30.0030.05710.17
5.1.20.0070.04010.27
5.1.10.0100.02710.32
5.1.00.0000.04310.13
5.0.50.0100.0238.55
5.0.40.0030.0308.49
5.0.30.0000.0438.21
5.0.20.0030.0238.29
5.0.10.0070.0278.25
5.0.00.0000.0438.27
4.4.90.0030.0277.20
4.4.80.0000.0237.20
4.4.70.0030.0207.20
4.4.60.0100.0207.20
4.4.50.0000.0237.20
4.4.40.0000.0507.20
4.4.30.0070.0207.20
4.4.20.0070.0177.20
4.4.10.0030.0207.20
4.4.00.0000.0337.20
4.3.110.0100.0137.20
4.3.100.0000.0237.20
4.3.90.0000.0237.20
4.3.80.0100.0237.20
4.3.70.0030.0207.20
4.3.60.0030.0207.20
4.3.50.0000.0237.20
4.3.40.0070.0277.20
4.3.30.0030.0207.20
4.3.20.0030.0207.20
4.3.10.0000.0237.20
4.3.00.0070.0237.29

preferences:
37.17 ms | 400 KiB | 5 Q