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 = "B0585788"; $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.0000.01416.75
8.3.50.0270.01121.12
8.3.40.0140.00718.84
8.3.30.0110.00418.71
8.3.20.0000.00720.21
8.3.10.0090.00623.34
8.3.00.0080.00019.68
8.2.180.0040.01118.28
8.2.170.0120.00322.96
8.2.160.0100.00320.43
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0000.00726.16
8.2.120.0060.00317.63
8.2.110.0030.00622.25
8.2.100.0120.00017.50
8.2.90.0070.00019.13
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00417.68
8.2.50.0030.00718.07
8.2.40.0040.00419.52
8.2.30.0050.00317.99
8.2.20.0030.00517.70
8.2.10.0000.00717.95
8.2.00.0060.00318.15
8.1.280.0110.01125.92
8.1.270.0060.00820.17
8.1.260.0050.00226.35
8.1.250.0000.00728.09
8.1.240.0030.00722.46
8.1.230.0120.00017.42
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0000.00818.51
8.1.160.0000.00821.91
8.1.150.0070.00018.75
8.1.140.0000.00817.44
8.1.130.0070.00017.71
8.1.120.0040.00417.42
8.1.110.0050.00317.33
8.1.100.0000.00817.31
8.1.90.0030.00517.48
8.1.80.0040.00417.28
8.1.70.0040.00417.44
8.1.60.0060.00317.59
8.1.50.0040.00417.52
8.1.40.0080.00017.54
8.1.30.0090.00017.64
8.1.20.0030.00617.63
8.1.10.0040.00417.46
8.1.00.0040.00417.45
8.0.300.0060.00318.77
8.0.290.0070.00016.75
8.0.280.0000.00718.30
8.0.270.0000.00717.29
8.0.260.0030.00317.20
8.0.250.0000.00717.01
8.0.240.0070.00016.98
8.0.230.0030.00316.83
8.0.220.0030.00316.93
8.0.210.0000.00716.77
8.0.200.0070.00016.97
8.0.190.0070.00317.02
8.0.180.0030.00316.93
8.0.170.0050.00316.96
8.0.160.0050.00216.96
8.0.150.0000.00816.82
8.0.140.0040.00416.80
8.0.130.0030.00313.37
8.0.120.0000.00816.88
8.0.110.0040.00416.91
8.0.100.0030.00516.95
8.0.90.0040.00416.92
8.0.80.0120.00316.88
8.0.70.0000.00816.78
8.0.60.0040.00416.96
8.0.50.0000.00716.80
8.0.30.0110.00617.09
8.0.20.0140.00517.40
8.0.10.0050.00316.91
8.0.00.0130.00816.75
7.4.330.0050.00015.08
7.4.320.0030.00316.53
7.4.300.0040.00416.52
7.4.290.0030.00316.60
7.4.280.0000.00716.61
7.4.270.0020.00516.52
7.4.260.0000.00716.49
7.4.250.0070.00016.59
7.4.240.0050.00216.56
7.4.230.0000.00716.72
7.4.220.0150.00616.54
7.4.210.0070.01016.57
7.4.200.0040.00416.70
7.4.160.0100.00716.53
7.4.150.0070.01017.40
7.4.140.0120.01217.86
7.4.130.0090.01216.61
7.4.120.0080.00816.57
7.4.110.0100.00716.41
7.4.100.0150.00316.66
7.4.90.0180.00416.51
7.4.80.0120.00819.39
7.4.70.0070.01616.49
7.4.60.0030.01316.47
7.4.50.0030.00516.54
7.4.40.0090.01216.42
7.4.30.0130.01016.51
7.4.00.0090.00614.69
7.3.330.0040.00413.39
7.3.320.0000.00513.32
7.3.310.0040.00416.23
7.3.300.0070.00016.40
7.3.290.0020.01216.36
7.3.280.0110.00916.39
7.3.270.0130.00317.40
7.3.260.0090.00916.39
7.3.250.0110.00916.41
7.3.240.0070.01316.53
7.3.230.0110.00616.39
7.3.210.0110.00616.35
7.3.200.0070.01016.32
7.3.190.0100.00516.41
7.3.180.0030.01316.54
7.3.170.0100.01016.46
7.3.160.0070.01016.33
7.2.330.0080.01216.68
7.2.320.0090.01016.71
7.2.310.0100.00716.65
7.2.300.0060.01016.41
7.2.290.0070.01716.55
7.2.60.0030.01016.70
7.2.00.0030.00919.37
7.1.200.0040.00315.71
7.1.100.0150.00018.00
7.1.70.0030.00517.11
7.1.60.0110.01420.03
7.1.50.0090.01516.79
7.1.00.0030.07722.29
7.0.200.0430.00315.02
7.0.60.0030.04020.08
7.0.50.0070.07017.97
7.0.40.0070.08720.19
7.0.30.0500.07020.27
7.0.20.0200.05320.25
7.0.10.0000.08020.25
7.0.00.0030.08720.16
5.6.280.0000.03321.16
5.6.210.0100.07720.71
5.6.200.0100.08318.20
5.6.190.0130.07320.52
5.6.180.3930.04720.77
5.6.170.0300.08020.55
5.6.160.0000.04720.47
5.6.150.0100.08318.22
5.6.140.0030.08018.23
5.6.130.0030.08018.35
5.6.120.0070.04721.09
5.6.110.0070.03721.22
5.6.100.0130.07321.07
5.6.90.0100.05021.06
5.6.80.0070.08320.48
5.6.70.4500.04020.61
5.5.350.0230.07020.35
5.5.340.0030.04317.96
5.5.330.0070.03720.57
5.5.320.4070.04320.27
5.5.310.0300.05020.51
5.5.300.0130.07718.14
5.5.290.0000.05318.02
5.5.280.0100.03720.85
5.5.270.0070.04720.92
5.5.260.0100.08320.92
5.5.250.0070.08720.60
5.5.240.0230.06720.24
5.4.450.0770.07319.36
5.4.440.0570.05719.35
5.4.430.0570.04719.17
5.4.420.0100.05319.52
5.4.410.0100.05719.50
5.4.400.0130.05019.03
5.4.390.0430.05719.34
5.4.380.0730.05019.02
5.4.370.0600.06319.32
5.4.360.0630.05719.37
5.4.350.0730.06019.34
5.4.340.0670.05719.14
5.4.320.0500.05719.14
5.4.310.0600.04719.21
5.4.300.0600.07719.23
5.4.290.0730.06018.81
5.4.280.0870.06019.19
5.4.270.0930.05719.02
5.4.260.0600.05319.32
5.4.250.0730.03719.23
5.4.240.0430.06319.29
5.4.230.0800.04719.02
5.4.220.0800.04719.32
5.4.210.0700.04718.80
5.4.200.0730.04319.02
5.4.190.0570.05718.84
5.4.180.0570.05018.80
5.4.170.0570.05319.31
5.4.160.0500.05719.17
5.4.150.0600.05019.12
5.4.140.0570.05716.57
5.4.130.0470.06016.44
5.4.120.0630.04316.57
5.4.110.0530.06016.48
5.4.100.0570.04716.58
5.4.90.0500.05716.30
5.4.80.0630.04316.61
5.4.70.0000.07716.42
5.4.60.0230.05716.31
5.4.50.0000.04316.52
5.4.40.0300.06716.39
5.4.30.0200.03316.45
5.4.20.0330.06316.51

preferences:
59.61 ms | 401 KiB | 5 Q