3v4l.org

run code in 300+ PHP versions simultaneously
<?php // DEFINE our cipher define('AES_256_CBC', 'aes-256-cbc'); // Generate a 256-bit encryption key // This should be stored somewhere instead of recreating it each time $encryption_key = openssl_random_pseudo_bytes(32); // Generate an initialization vector // This *MUST* be available for decryption as well $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(AES_256_CBC)); // Create some data to encrypt $data = "Encrypt me, please!"; echo "Before encryption: $data\n"; // Encrypt $data using aes-256-cbc cipher with the given encryption key and // our initialization vector. The 0 gives us the default options, but can // be changed to OPENSSL_RAW_DATA or OPENSSL_ZERO_PADDING $encrypted = openssl_encrypt($data, AES_256_CBC, $encryption_key, 0, $iv); echo "Encrypted: $encrypted\n"; // If we lose the $iv variable, we can't decrypt this, so append it to the // encrypted data with a separator that we know won't exist in base64-encoded // data $encrypted = $encrypted . ':' . $iv; // To decrypt, separate the encrypted data from the initialization vector ($iv) $parts = explode(':', $encrypted); // $parts[0] = encrypted data // $parts[1] = initialization vector $decrypted = openssl_decrypt($parts[0], AES_256_CBC, $encryption_key, 0, $parts[1]); echo "Decrypted: $decrypted\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.60.0090.00616.63
8.3.50.0110.00821.10
8.3.40.0090.00618.77
8.3.30.0140.00318.89
8.3.20.0080.00020.16
8.3.10.0050.00323.66
8.3.00.0000.00822.54
8.2.180.0130.00316.63
8.2.170.0070.00722.96
8.2.160.0130.00020.39
8.2.150.0070.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00317.63
8.2.110.0030.00720.35
8.2.100.0090.00317.63
8.2.90.0040.00419.23
8.2.80.0050.00317.97
8.2.70.0050.00317.75
8.2.60.0000.00817.90
8.2.50.0030.00618.07
8.2.40.0030.00520.94
8.2.30.0040.00419.77
8.2.20.0050.00317.62
8.2.10.0000.00718.01
8.2.00.0000.00718.05
8.1.280.0040.01125.92
8.1.270.0080.00020.37
8.1.260.0000.00826.35
8.1.250.0020.00528.09
8.1.240.0090.00023.92
8.1.230.0040.00717.42
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0000.01017.10
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0000.00818.46
8.1.160.0050.00321.87
8.1.150.0000.00718.82
8.1.140.0000.00817.32
8.1.130.0000.00717.59
8.1.120.0040.00417.23
8.1.110.0000.00717.34
8.1.100.0070.00017.34
8.1.90.0080.00017.36
8.1.80.0080.00017.39
8.1.70.0000.00717.39
8.1.60.0040.00417.44
8.1.50.0050.00317.40
8.1.40.0040.00417.36
8.1.30.0030.00717.55
8.1.20.0040.00417.56
8.1.10.0060.00317.42
8.1.00.0020.00517.48
8.0.300.0040.00418.77
8.0.290.0050.00516.75
8.0.280.0030.00318.35
8.0.270.0030.00317.27
8.0.260.0030.00317.09
8.0.250.0030.00617.00
8.0.240.0050.00216.91
8.0.230.0080.00016.98
8.0.220.0060.00016.80
8.0.210.0060.00316.91
8.0.200.0000.00716.94
8.0.190.0040.00416.86
8.0.180.0030.00516.99
8.0.170.0030.00516.97
8.0.160.0030.00316.78
8.0.150.0000.00716.91
8.0.140.0080.00016.82
8.0.130.0000.00613.36
8.0.120.0080.00016.87
8.0.110.0040.00416.84
8.0.100.0040.00416.80
8.0.90.0040.00416.93
8.0.80.0060.01016.79
8.0.70.0040.00416.86
8.0.60.0040.00417.03
8.0.50.0080.00016.75
8.0.30.0090.00917.18
8.0.20.0110.01117.40
8.0.10.0000.00717.00
8.0.00.0100.00916.66
7.4.330.0000.00515.08
7.4.320.0060.00016.39
7.4.300.0060.00016.40
7.4.290.0060.00316.56
7.4.280.0030.00616.54
7.4.270.0000.00716.51
7.4.260.0040.00416.39
7.4.250.0030.00616.51
7.4.240.0020.00516.41
7.4.230.0000.00716.63
7.4.220.0060.01216.65
7.4.210.0100.00516.51
7.4.200.0000.00816.36
7.4.160.0090.00616.41
7.4.150.0150.00617.40
7.4.140.0080.01117.86
7.4.130.0110.00816.45
7.4.120.0110.00616.54
7.4.110.0070.01016.34
7.4.100.0120.00916.42
7.4.90.0120.00616.48
7.4.80.0120.00619.39
7.4.70.0070.01016.33
7.4.60.0070.01016.21
7.4.50.0040.00416.14
7.4.40.0130.00316.39
7.4.30.0110.00516.57
7.4.00.0030.01014.82
7.3.330.0030.00313.16
7.3.320.0000.00613.14
7.3.310.0030.00316.36
7.3.300.0040.00416.31
7.3.290.0050.00316.11
7.3.280.0130.00716.23
7.3.270.0070.01017.40
7.3.260.0120.00616.45
7.3.250.0100.00716.41
7.3.240.0060.01216.30
7.3.230.0180.00616.39
7.3.210.0130.00316.36
7.3.200.0000.01716.58
7.3.190.0050.01416.27
7.3.180.0040.01116.30
7.3.170.0030.01216.33
7.3.160.0030.01416.29
7.3.10.0420.00815.89
7.3.00.0390.01116.16
7.2.330.0140.00516.60
7.2.320.0060.01116.62
7.2.310.0110.00516.43
7.2.300.0070.01016.64
7.2.290.0160.00316.20
7.2.130.0150.00316.36
7.2.120.0320.01216.67
7.2.110.0300.00816.57
7.2.100.0480.00616.78
7.2.90.0370.00416.25
7.2.80.0580.00716.47
7.2.70.0390.00716.34
7.2.60.0240.00616.79
7.2.50.0470.01616.71
7.2.40.0450.01416.51
7.2.30.0100.01015.80
7.2.20.0110.00616.18
7.2.10.0130.00616.02
7.2.00.0160.00318.14
7.1.250.0360.00715.09
7.1.70.0030.00517.49
7.1.60.0030.00717.44
7.1.50.0080.00317.18
7.1.40.0060.01216.90
7.1.30.0030.01716.96
7.1.20.0030.01316.66
7.1.10.0030.00616.61
7.1.00.0000.01516.76
7.0.200.0040.00416.98
7.0.190.0000.01516.93
7.0.180.0030.01416.46
7.0.170.0030.01216.37
7.0.160.0000.00916.50
7.0.150.0040.00416.54
7.0.140.0030.00816.38
7.0.130.0000.00716.86
7.0.120.0000.00716.60
7.0.110.0000.00816.28
7.0.100.0000.00716.43
7.0.90.0070.00416.71
7.0.80.0040.00416.51
7.0.70.0000.00816.40
7.0.60.0040.00416.52
7.0.50.0000.00916.58
7.0.40.0030.00515.43
7.0.30.0000.00715.43
7.0.20.0060.00615.43
7.0.10.0050.00215.43
7.0.00.0030.00515.43
5.6.300.0070.03720.92
5.6.290.0000.04521.14
5.6.280.0070.03721.00
5.6.270.0000.04321.16
5.6.260.0000.04320.92
5.6.250.0030.03921.17
5.6.240.0000.06720.98
5.6.230.0000.04821.04
5.6.220.0000.05021.05
5.6.210.0000.04421.07
5.6.200.0060.03921.05
5.6.190.0090.03821.12
5.6.180.0040.04221.13
5.6.170.0030.04520.89
5.6.160.0000.04321.08
5.6.150.0000.04421.14
5.6.140.0030.04120.88
5.6.130.0000.05020.82
5.6.120.0000.04421.04
5.6.110.0030.04121.03
5.6.100.0030.04521.11
5.6.90.0000.04320.98
5.6.80.0000.04220.23
5.6.70.0000.04620.23
5.6.60.0070.05320.55
5.6.50.0000.04120.55
5.6.40.0070.04620.51
5.6.30.0000.04320.22
5.6.20.0030.03920.37
5.6.10.0090.03220.21
5.6.00.0030.03920.18
5.5.380.0030.03917.73
5.5.370.0030.05517.54
5.5.360.0030.05717.57
5.5.350.0070.03617.52
5.5.340.0040.03918.06
5.5.330.0100.03617.87
5.5.320.0000.04418.18
5.5.310.0000.04217.90
5.5.300.0040.04017.92
5.5.290.0070.04317.92
5.5.280.0030.03918.19
5.5.270.0030.04818.16
5.5.260.0070.04618.05
5.5.250.0030.03917.88
5.5.240.0070.03317.48
5.5.230.0060.03517.53
5.5.220.0030.04317.56
5.5.210.0030.03817.38
5.5.200.0060.03517.25
5.5.190.0060.03917.54
5.5.180.0070.04017.21
5.5.160.0000.04017.42
5.5.150.0030.03717.50
5.5.140.0070.03317.53
5.5.130.0000.04017.55
5.5.120.0070.03317.50
5.5.110.0030.03817.44
5.5.100.0030.03717.41
5.5.90.0070.03817.34
5.5.80.0030.03717.16
5.5.70.0030.03617.31
5.5.60.0070.03917.30
5.5.50.0070.04117.42
5.5.40.0000.04017.33
5.5.30.0030.04517.39
5.5.20.0030.04117.31
5.5.10.0030.04317.33
5.5.00.0030.03717.32
5.4.450.0000.04719.60
5.4.440.0030.04019.38
5.4.430.0000.04419.28
5.4.420.0030.04419.59
5.4.410.0000.05519.36
5.4.400.0000.04219.13
5.4.390.0030.03819.11
5.4.380.0070.04119.09
5.4.370.0030.03619.00
5.4.360.0070.03419.05
5.4.350.0030.03619.09
5.4.340.0040.03918.98
5.4.320.0030.03719.16
5.4.310.0000.04019.20
5.4.300.0070.03318.96
5.4.290.0070.03319.22
5.4.280.0030.03819.20
5.4.270.0030.03618.94
5.4.260.0070.03619.22
5.4.250.0000.04118.93
5.4.240.0070.03319.12
5.4.230.0030.04019.21
5.4.220.0000.04219.08
5.4.210.0030.03819.18
5.4.200.0030.04418.95
5.4.190.0070.03719.10
5.4.180.0030.03718.98
5.4.170.0030.03819.04
5.4.160.0000.04019.25
5.4.150.0000.04219.12
5.4.140.0030.03916.36
5.4.130.0030.04116.51
5.4.120.0030.03416.47
5.4.110.0030.03516.59
5.4.100.0030.03816.35
5.4.90.0030.03416.51
5.4.80.0100.02916.48
5.4.70.0000.04416.49
5.4.60.0000.03816.44
5.4.50.0070.03316.60
5.4.40.0000.04316.71
5.4.30.0000.04016.47
5.4.20.0060.03816.32
5.4.10.0160.03916.32
5.4.00.0070.03415.83
5.3.290.0040.03615.43
5.3.280.0280.02815.43
5.3.270.0070.04015.43
5.3.260.0030.04115.43
5.3.250.0000.04115.43
5.3.240.0030.04415.43
5.3.230.0000.03915.43
5.3.220.0030.03715.43
5.3.210.0000.04115.43
5.3.200.0030.03515.43
5.3.190.0000.04115.43
5.3.180.0070.03215.43
5.3.170.0100.03315.43
5.3.160.0030.03815.43
5.3.150.0070.03315.43
5.3.140.0000.04115.43
5.3.130.0030.04715.43
5.3.120.0030.06315.43
5.3.110.0030.03615.43
5.3.100.0000.03915.43
5.3.90.0000.04115.43
5.3.80.0000.04215.43
5.3.70.0030.03815.43
5.3.60.0030.03615.43
5.3.50.0070.03415.43
5.3.40.0030.03515.43
5.3.30.0030.03915.43
5.3.20.0000.03915.43
5.3.10.0070.03315.43
5.3.00.0030.03515.43
5.2.170.0070.03015.43
5.2.160.0000.03115.43
5.2.150.0030.03115.43
5.2.140.0000.03415.43
5.2.130.0000.03715.43
5.2.120.0000.03215.43
5.2.110.0000.03415.43
5.2.100.0040.02915.43
5.2.90.0220.01915.43
5.2.80.0090.02115.43
5.2.70.0000.03115.43
5.2.60.0180.02815.43
5.2.50.0060.02615.43
5.2.40.0030.02715.43
5.2.30.0000.03315.43
5.2.20.0060.02615.43
5.2.10.0030.02615.43
5.2.00.0030.02615.43
5.1.60.0030.02215.43
5.1.50.0060.03215.43
5.1.40.0030.02415.43
5.1.30.0070.02015.43
5.1.20.0000.02815.43
5.1.10.0000.02715.43
5.1.00.0030.02315.43
5.0.50.0000.02115.43
5.0.40.0000.02315.43
5.0.30.0030.02915.43
5.0.20.0170.01415.43
5.0.10.0100.01315.43
5.0.00.0070.02715.43
4.4.90.0030.01515.43
4.4.80.0060.01115.43
4.4.70.0000.01615.43
4.4.60.0110.00815.43
4.4.50.0030.01315.43
4.4.40.0000.03015.43
4.4.30.0000.01615.43
4.4.20.0060.01315.43
4.4.10.0000.01815.43
4.4.00.0000.02515.43
4.3.110.0000.01815.43
4.3.100.0000.01715.43
4.3.90.0100.01015.43
4.3.80.0000.02415.43
4.3.70.0000.02115.43
4.3.60.0000.01615.43
4.3.50.0040.01215.43
4.3.40.0060.02215.43
4.3.30.0040.02215.43
4.3.20.0000.02115.43
4.3.10.0060.01115.43
4.3.00.0000.01815.43

preferences:
62.56 ms | 401 KiB | 5 Q