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 = "a"; $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.0090.00916.38
8.3.50.0100.01016.38
8.3.40.0080.00818.62
8.3.30.0070.01018.70
8.3.20.0040.01120.20
8.3.10.0080.00023.51
8.3.00.0060.00319.68
8.2.180.0180.00016.63
8.2.170.0150.00422.96
8.2.160.0130.00320.35
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00417.63
8.2.110.0000.00922.32
8.2.100.0120.00017.75
8.2.90.0060.00319.17
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0000.00819.52
8.2.30.0000.00717.89
8.2.20.0030.00517.75
8.2.10.0040.00417.93
8.2.00.0050.00217.95
8.1.280.0100.00725.92
8.1.270.0000.00820.20
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0100.00722.42
8.1.230.0090.00317.42
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0030.00617.36
8.1.190.0000.00817.22
8.1.180.0060.00318.10
8.1.170.0030.00618.40
8.1.160.0040.00421.84
8.1.150.0050.00218.75
8.1.140.0040.00417.40
8.1.130.0030.00317.65
8.1.120.0030.00417.38
8.1.110.0000.00717.39
8.1.100.0070.00017.31
8.1.90.0040.00417.38
8.1.80.0000.00817.41
8.1.70.0000.00717.25
8.1.60.0000.00917.60
8.1.50.0000.00817.61
8.1.40.0040.00417.48
8.1.30.0030.00517.69
8.1.20.0040.00417.59
8.1.10.0040.00417.62
8.1.00.0000.00817.49
8.0.300.0040.00418.77
8.0.290.0050.00316.63
8.0.280.0000.00718.40
8.0.270.0000.00716.90
8.0.260.0030.00317.07
8.0.250.0030.00516.87
8.0.240.0040.00416.95
8.0.230.0000.00716.93
8.0.220.0030.00316.89
8.0.210.0030.00416.76
8.0.200.0000.00716.86
8.0.190.0060.00316.95
8.0.180.0040.00416.94
8.0.170.0060.00316.91
8.0.160.0040.00416.94
8.0.150.0060.00316.86
8.0.140.0000.00816.83
8.0.130.0060.00013.41
8.0.120.0000.00816.86
8.0.110.0020.00516.87
8.0.100.0070.00016.75
8.0.90.0040.00416.70
8.0.80.0090.00916.96
8.0.70.0070.00016.93
8.0.60.0040.00416.78
8.0.50.0040.00416.97
8.0.30.0160.00417.14
8.0.20.0090.01017.40
8.0.10.0000.00716.82
8.0.00.0150.00616.67
7.4.330.0000.00515.08
7.4.320.0040.00316.56
7.4.300.0030.00316.56
7.4.290.0030.00316.62
7.4.280.0040.00416.41
7.4.270.0000.00716.52
7.4.260.0030.00316.52
7.4.250.0000.00716.53
7.4.240.0000.00716.51
7.4.230.0000.00816.64
7.4.220.0000.01916.47
7.4.210.0030.01316.51
7.4.200.0070.00016.46
7.4.160.0060.00916.51
7.4.150.0030.01317.40
7.4.140.0100.00817.86
7.4.130.0100.01116.49
7.4.120.0100.00716.50
7.4.110.0030.01416.78
7.4.100.0100.01416.42
7.4.90.0100.00716.59
7.4.80.0070.01619.39
7.4.70.0060.01616.57
7.4.60.0090.00616.62
7.4.50.0090.00016.55
7.4.40.0100.00716.35
7.4.30.0060.01116.64
7.4.00.0070.00714.82
7.3.330.0070.00013.38
7.3.320.0000.00613.36
7.3.310.0040.00416.41
7.3.300.0060.00016.24
7.3.290.0090.00816.39
7.3.280.0090.01016.36
7.3.270.0120.01217.40
7.3.260.0120.00916.37
7.3.250.0110.00616.49
7.3.240.0160.00016.27
7.3.230.0140.00916.58
7.3.210.0090.00916.41
7.3.200.0150.00616.60
7.3.190.0070.01016.54
7.3.180.0030.01716.34
7.3.170.0100.00716.49
7.3.160.0130.00416.32
7.3.120.0100.00714.60
7.3.110.0070.00714.85
7.3.100.0030.01314.87
7.3.90.0030.01414.73
7.3.80.0060.00914.89
7.3.70.0090.00014.80
7.3.60.0060.00314.84
7.3.50.0080.00414.82
7.3.40.0140.00014.62
7.3.30.0000.01414.91
7.3.20.0030.01316.54
7.3.10.0080.00816.62
7.3.00.0120.00616.34
7.2.330.0090.00916.36
7.2.320.0060.01316.31
7.2.310.0030.01516.37
7.2.300.0090.00916.37
7.2.290.0130.00716.65
7.2.240.0030.01314.80
7.2.230.0000.01014.95
7.2.220.0090.00615.11
7.2.210.0030.01215.07
7.2.200.0090.00614.88
7.2.190.0060.00614.79
7.2.180.0040.01114.96
7.2.170.0000.01414.65
7.2.160.0070.01114.96
7.2.150.0030.01016.87
7.2.140.0060.01216.71
7.2.130.0060.00916.83
7.2.120.0110.01116.88
7.2.110.0090.00616.77
7.2.100.0130.00316.59
7.2.90.0090.01216.46
7.2.80.0000.01216.52
7.2.70.0030.00616.50
7.2.60.0070.01016.77
7.2.50.0100.00616.79
7.2.40.0040.00816.55
7.2.30.0100.00616.83
7.2.20.0070.00716.82
7.2.10.0000.01316.93
7.2.00.0020.01118.01
7.1.330.0040.01415.63
7.1.320.0100.00715.72
7.1.310.0070.00715.77
7.1.300.0100.00615.79
7.1.290.0040.01215.70
7.1.280.0110.00415.78
7.1.270.0030.01315.69
7.1.260.0030.00615.53
7.1.250.0090.00615.44
7.1.200.0000.01215.63
7.1.100.0070.00417.94
7.1.70.0040.00417.11
7.1.60.0040.02120.03
7.1.50.0070.01816.81
7.1.00.0070.07322.35
7.0.200.0240.00714.68
7.0.60.0070.08319.91
7.0.50.0130.07318.14
7.0.40.0070.04720.15
7.0.30.0530.07720.11
7.0.20.0100.05320.24
7.0.10.0070.07020.34
7.0.00.0100.07020.06
5.6.280.0030.04721.00
5.6.210.0230.06720.76
5.6.200.0100.06718.25
5.6.190.0130.08320.67
5.6.180.3230.03720.66
5.6.170.0100.04720.59
5.6.160.0100.08020.71
5.6.150.0070.07718.19
5.6.140.0070.03718.21
5.6.130.0200.06718.19
5.6.120.0130.08021.14
5.6.110.0070.08321.07
5.6.100.0030.07721.07
5.6.90.0070.07321.23
5.6.80.0030.04020.42
5.6.70.4570.03720.55
5.5.350.0200.08320.32
5.5.340.0070.04717.98
5.5.330.0000.04320.32
5.5.320.0330.04320.40
5.5.310.0330.05720.38
5.5.300.0000.04717.99
5.5.290.0100.08018.04
5.5.280.0100.08720.85
5.5.270.0130.07720.68
5.5.260.0070.03720.68
5.5.250.0100.07720.63
5.5.240.0130.04720.30
5.4.450.0400.04319.61
5.4.440.0300.04019.50
5.4.430.0430.07019.41
5.4.420.0470.06019.38
5.4.410.0330.05719.46
5.4.400.0330.03719.32
5.4.390.0300.04018.95
5.4.380.0270.04019.17
5.4.370.0300.06019.32
5.4.360.0270.04319.14
5.4.350.0400.04319.13
5.4.340.0400.06319.28
5.4.320.0430.05718.95
5.4.310.0330.07319.28
5.4.300.0430.05719.24
5.4.290.0300.04019.19
5.4.280.0230.04718.85
5.4.270.0430.03319.15
5.4.260.0300.04019.13
5.4.250.0370.05019.07
5.4.240.0370.03319.17
5.4.230.0330.03318.99
5.4.220.0530.07019.04
5.4.210.0470.05319.06
5.4.200.0470.07019.27
5.4.190.0330.03719.15
5.4.180.0300.03719.19
5.4.170.0570.05019.22
5.4.160.0400.05019.21
5.4.150.0370.03318.86
5.4.140.0400.06316.42
5.4.130.0430.06016.50
5.4.120.0470.04316.52
5.4.110.0300.05716.52
5.4.100.0270.04016.48
5.4.90.0370.06716.61
5.4.80.0330.07716.47

preferences:
60.74 ms | 400 KiB | 5 Q