3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Security { public static function encrypt($input, $key) { $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $input = Security::pkcs5_pad($input, $size); $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $key, $iv); $data = mcrypt_generic($td, $input); mcrypt_generic_deinit($td); mcrypt_module_close($td); $data = base64_encode($data); return $data; } private static function pkcs5_pad ($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } public static function decrypt($sStr, $sKey) { $decrypted= mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $sKey, base64_decode($sStr), MCRYPT_MODE_ECB ); $dec_s = strlen($decrypted); $padding = ord($decrypted[$dec_s-1]); $decrypted = substr($decrypted, 0, -$padding); return $decrypted; } } $value = "b"; $key = "KluczSzyfrujacyI"; //16 Character Key echo Security::encrypt($value, $key); echo Security::decrypt(Security::encrypt($value, $key), $key); ?>

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.0150.00418.39
8.3.50.0100.01221.19
8.3.40.0140.00719.02
8.3.30.0040.01118.85
8.3.20.0080.00020.21
8.3.10.0110.00723.35
8.3.00.0040.00419.79
8.2.180.0150.00316.63
8.2.170.0170.00322.96
8.2.160.0140.00020.34
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00317.63
8.2.110.0100.00022.08
8.2.100.0100.00317.50
8.2.90.0040.00419.22
8.2.80.0040.00417.97
8.2.70.0050.00317.62
8.2.60.0040.00417.80
8.2.50.0000.00818.07
8.2.40.0000.00919.38
8.2.30.0030.00619.79
8.2.20.0080.00017.69
8.2.10.0040.00417.95
8.2.00.0040.00417.95
8.1.280.0060.01025.92
8.1.270.0180.00020.38
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0100.00022.42
8.1.230.0120.00017.42
8.1.220.0080.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.22
8.1.180.0020.00518.10
8.1.170.0060.00318.43
8.1.160.0030.00521.87
8.1.150.0040.00418.71
8.1.140.0000.00817.42
8.1.130.0070.00017.66
8.1.120.0070.00017.35
8.1.110.0040.00417.27
8.1.100.0000.00717.41
8.1.90.0040.00417.42
8.1.80.0000.00717.38
8.1.70.0030.00317.29
8.1.60.0030.00617.57
8.1.50.0000.00917.48
8.1.40.0040.00417.45
8.1.30.0040.00417.59
8.1.20.0000.00817.65
8.1.10.0000.00817.50
8.1.00.0000.00817.43
8.0.300.0070.00318.77
8.0.290.0050.00216.75
8.0.280.0030.00318.31
8.0.270.0000.00717.24
8.0.260.0000.00617.12
8.0.250.0040.00416.96
8.0.240.0030.00316.96
8.0.230.0000.00816.94
8.0.220.0070.00016.79
8.0.210.0020.00516.81
8.0.200.0000.00716.80
8.0.190.0040.00416.94
8.0.180.0040.00416.82
8.0.170.0040.00416.83
8.0.160.0040.00416.95
8.0.150.0040.00416.84
8.0.140.0070.00016.85
8.0.130.0040.00413.31
8.0.120.0060.00316.77
8.0.110.0040.00416.84
8.0.100.0000.00916.88
8.0.90.0030.00316.85
8.0.80.0090.00616.93
8.0.70.0000.00816.93
8.0.60.0030.00316.94
8.0.50.0000.00816.84
8.0.30.0080.01216.99
8.0.20.0130.00717.40
8.0.10.0030.00617.03
8.0.00.0100.01116.76
7.4.330.0060.00015.08
7.4.320.0000.00716.47
7.4.300.0030.00316.54
7.4.290.0000.00716.66
7.4.280.0050.00316.60
7.4.270.0070.00016.48
7.4.260.0030.00516.43
7.4.250.0040.00416.56
7.4.240.0010.00616.59
7.4.230.0040.00416.41
7.4.220.0120.00316.68
7.4.210.0060.01016.64
7.4.200.0050.00316.55
7.4.160.0170.00316.27
7.4.150.0170.00017.40
7.4.140.0180.00617.86
7.4.130.0110.01116.63
7.4.120.0090.01116.49
7.4.110.0120.00616.41
7.4.100.0090.00916.42
7.4.90.0120.00616.57
7.4.80.0160.00019.39
7.4.70.0000.01616.42
7.4.60.0100.00716.46
7.4.50.0030.00616.32
7.4.40.0100.00716.45
7.4.30.0090.01216.43
7.4.00.0120.00614.86
7.3.330.0060.00013.31
7.3.320.0020.00213.43
7.3.310.0040.00416.42
7.3.300.0000.00716.43
7.3.290.0090.00716.38
7.3.280.0080.01116.39
7.3.270.0110.00817.40
7.3.260.0140.00316.58
7.3.250.0080.01016.52
7.3.240.0160.00616.59
7.3.230.0090.01316.41
7.3.210.0070.01016.36
7.3.200.0060.01016.31
7.3.190.0070.01016.40
7.3.180.0130.00916.59
7.3.170.0130.01116.49
7.3.160.0140.00316.33
7.3.120.0070.01014.77
7.3.110.0100.00714.60
7.3.100.0090.00614.90
7.3.90.0040.00714.79
7.3.80.0050.00815.10
7.3.70.0070.01014.83
7.3.60.0060.01114.95
7.3.50.0070.00414.67
7.3.40.0060.00614.77
7.3.30.0060.00614.66
7.3.20.0090.00016.53
7.3.10.0050.00716.50
7.3.00.0080.00616.63
7.2.330.0110.00716.61
7.2.320.0120.01316.50
7.2.310.0070.01016.71
7.2.300.0060.01616.41
7.2.290.0090.00916.63
7.2.250.0130.00615.02
7.2.240.0100.01014.97
7.2.230.0130.00614.54
7.2.220.0060.00615.15
7.2.210.0000.01314.74
7.2.200.0000.01515.11
7.2.190.0090.00914.80
7.2.180.0090.00614.67
7.2.170.0060.01214.96
7.2.160.0090.00614.95
7.2.150.0050.00516.78
7.2.140.0060.00916.76
7.2.130.0060.00816.83
7.2.120.0060.00816.61
7.2.110.0050.00916.56
7.2.100.0030.00916.88
7.2.90.0060.00816.74
7.2.80.0050.00516.61
7.2.70.0060.00716.79
7.2.60.0040.00916.65
7.2.50.0020.01216.85
7.2.40.0050.01016.91
7.2.30.0040.01016.81
7.2.20.0070.00716.71
7.2.10.0090.00716.83
7.2.00.0030.00917.57
7.1.330.0060.00915.74
7.1.320.0100.00615.76
7.1.310.0000.01115.85
7.1.300.0040.01415.55
7.1.290.0070.00715.51
7.1.280.0070.01015.80
7.1.270.0040.00715.80
7.1.260.0030.01215.79
7.1.250.0040.00715.47
7.1.200.0090.00315.89
7.1.100.0030.01017.76
7.1.70.0040.00417.13
7.1.60.0090.01620.03
7.1.50.0130.02016.96
7.1.00.0000.08022.43
7.0.200.0210.00414.92
7.0.110.0430.07320.01
7.0.100.0230.04019.97
7.0.90.0370.03720.11
7.0.80.0470.03320.13
7.0.70.0330.05719.91
7.0.60.0370.07019.96
7.0.50.0270.04020.03
7.0.40.0070.04019.66
7.0.30.0000.04319.71
7.0.20.0000.04319.74
7.0.10.0030.03319.65
7.0.00.0030.08319.80
5.6.280.0000.05721.16
5.6.260.0070.04320.60
5.6.250.0070.08720.65
5.6.240.0070.04020.49
5.6.230.0070.03720.48
5.6.220.0170.06720.66
5.6.210.0100.05320.41
5.6.200.0070.08320.65
5.6.190.0030.04020.71
5.6.180.0070.03720.59
5.6.170.0130.03320.63
5.6.160.0070.03720.53
5.6.150.0030.05320.62
5.6.140.0030.04720.56
5.6.130.0030.06020.47
5.6.120.0100.04020.47
5.6.110.0000.04320.56
5.6.100.0000.07320.63
5.6.90.0030.08020.46
5.6.80.0070.06720.10
5.6.70.0070.06320.04
5.6.60.0000.05320.00
5.6.50.0100.07020.09
5.6.40.0000.04320.01
5.6.30.0130.06319.84
5.6.20.0030.08020.07
5.6.10.0000.07320.21
5.6.00.0030.04319.91
5.5.380.0030.04317.56
5.5.370.0030.08317.55
5.5.360.0000.04017.71
5.5.350.0000.04317.48
5.5.340.0130.02718.11
5.5.330.0030.07318.23
5.5.320.0030.04017.95
5.5.310.0070.03718.09
5.5.300.0100.05718.14
5.5.290.0100.06718.00
5.5.280.0100.04718.26
5.5.270.0030.06018.29
5.5.260.0070.06718.07
5.5.250.0070.06317.78
5.5.240.0000.07017.48
5.5.230.0030.04317.33
5.5.220.0000.06017.51
5.5.210.0070.07317.64
5.5.200.0030.05717.58
5.5.190.0070.06317.35
5.5.180.0000.07717.37
5.5.160.0000.04017.49
5.5.150.0000.07017.43
5.5.140.0100.07317.44
5.5.130.0100.06717.47
5.5.120.0100.07317.50
5.5.110.0070.03717.30
5.5.100.0000.05717.34
5.5.90.0000.03717.54
5.5.80.0000.03717.08
5.5.70.0000.03717.33
5.5.60.0000.07017.24
5.5.50.0000.03717.07
5.5.40.0070.05317.17
5.5.30.0100.05717.32
5.5.20.0070.03717.07
5.5.10.0100.08017.53
5.5.00.0000.04017.32
5.4.450.0030.08319.33
5.4.440.0030.07319.35
5.4.430.0070.06319.32
5.4.420.0070.05019.50
5.4.410.0000.04719.52
5.4.400.0070.03719.14
5.4.390.0070.07719.14
5.4.380.0070.04719.20
5.4.370.0100.05019.14
5.4.360.0070.05719.00
5.4.350.0070.03719.03
5.4.340.0000.05019.25
5.4.320.0100.05319.34
5.4.310.0070.03719.24
5.4.300.0030.04719.14
5.4.290.0130.07019.23
5.4.280.0030.07719.25
5.4.270.0000.04319.01
5.4.260.0070.03319.34
5.4.250.0030.03319.23
5.4.240.0070.05719.34
5.4.230.0030.04019.03
5.4.220.0000.07719.03
5.4.210.0000.05019.22
5.4.200.0170.05718.99
5.4.190.0030.03719.00
5.4.180.0100.04319.15
5.4.170.0100.04319.19
5.4.160.0000.04019.03
5.4.150.0030.04018.98
5.4.140.0130.04016.52
5.4.130.0030.04716.52
5.4.120.0100.04316.56
5.4.110.0000.05316.54
5.4.100.0070.03316.60
5.4.90.0030.04716.46
5.4.80.0070.03716.69
5.4.70.0030.04316.36
5.4.60.0100.03316.53
5.4.50.0030.04016.37
5.4.40.0030.03716.34
5.4.30.0000.04316.57
5.4.20.0130.03016.45
5.4.10.0030.04016.57
5.4.00.0030.03716.05

preferences:
56.09 ms | 401 KiB | 5 Q