3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'Dup.A.123' => 1, 'D' => 4, ); $replacements = array( 'A.123' => 'A123', 'Dup.A' => 'DD', ); foreach (array_keys($array) as $key) { foreach ($replacements as $from => $to) { if (!strncmp($key, $from, strlen($from))) { $array[$to . substr($key, strlen($from))] = $array[$key]; unset($array[$key]); } } } print_r($array);

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.0120.00316.63
8.3.50.0110.00721.91
8.3.40.0120.00918.96
8.3.30.0110.00318.92
8.3.20.0070.00020.29
8.3.10.0080.00023.48
8.3.00.0040.00422.52
8.2.180.0180.00416.47
8.2.170.0180.00422.96
8.2.160.0040.01220.53
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0080.00022.12
8.2.110.0070.00322.00
8.2.100.0120.00017.78
8.2.90.0050.00318.03
8.2.80.0060.00319.11
8.2.70.0060.00318.04
8.2.60.0040.00417.93
8.2.50.0040.00418.10
8.2.40.0080.00020.39
8.2.30.0030.00517.99
8.2.20.0080.00017.59
8.2.10.0040.00419.54
8.2.00.0000.00717.61
8.1.280.0120.00325.92
8.1.270.0040.00423.70
8.1.260.0050.00226.35
8.1.250.0050.00228.09
8.1.240.0000.00822.14
8.1.230.0040.00720.96
8.1.220.0040.00417.76
8.1.210.0000.00818.79
8.1.200.0080.00017.23
8.1.190.0090.00017.23
8.1.180.0050.00318.10
8.1.170.0040.00418.66
8.1.160.0030.00622.06
8.1.150.0000.00718.59
8.1.140.0030.00517.44
8.1.130.0070.00017.78
8.1.120.0000.00817.39
8.1.110.0000.01117.40
8.1.100.0000.00717.33
8.1.90.0000.00717.43
8.1.80.0030.00317.34
8.1.70.0030.00317.36
8.1.60.0040.00417.62
8.1.50.0000.00717.52
8.1.40.0000.00717.46
8.1.30.0000.00817.52
8.1.20.0000.00717.63
8.1.10.0040.00417.47
8.1.00.0040.00417.51
8.0.300.0040.00419.98
8.0.290.0000.00816.63
8.0.280.0000.00718.36
8.0.270.0000.00717.21
8.0.260.0070.00016.75
8.0.250.0070.00016.96
8.0.240.0030.00316.96
8.0.230.0070.00016.83
8.0.220.0030.00316.85
8.0.210.0030.00316.81
8.0.200.0030.00516.81
8.0.190.0000.00816.92
8.0.180.0040.00416.82
8.0.170.0040.00416.79
8.0.160.0000.00816.88
8.0.150.0080.00016.77
8.0.140.0030.00516.73
8.0.130.0060.00013.33
8.0.120.0080.00016.84
8.0.110.0000.00816.78
8.0.100.0070.00016.75
8.0.90.0000.00716.89
8.0.80.0150.00616.79
8.0.70.0060.00316.83
8.0.60.0040.00416.83
8.0.50.0030.00516.73
8.0.30.0140.00517.13
8.0.20.0090.01517.40
8.0.10.0000.00717.06
8.0.00.0120.00916.87
7.4.330.0050.00015.13
7.4.320.0000.00716.42
7.4.300.0000.00616.44
7.4.290.0000.00716.52
7.4.280.0000.00716.54
7.4.270.0040.00416.64
7.4.260.0030.00316.55
7.4.250.0060.00316.55
7.4.240.0020.00516.56
7.4.230.0000.00716.66
7.4.220.0060.01816.45
7.4.210.0060.00816.53
7.4.200.0000.00716.39
7.4.190.0040.00416.64
7.4.160.0110.00516.58
7.4.150.0040.01417.40
7.4.140.0140.00517.86
7.4.130.0100.00616.43
7.4.120.0130.00516.40
7.4.110.0110.00616.37
7.4.100.0070.01116.49
7.4.90.0070.01716.50
7.4.80.0060.01019.39
7.4.70.0150.00816.66
7.4.60.0080.00816.46
7.4.50.0040.00416.64
7.4.40.0060.00922.77
7.4.30.0070.01016.50
7.4.00.0110.00414.84
7.3.330.0000.00613.21
7.3.320.0000.00613.26
7.3.310.0020.00516.15
7.3.300.0030.00316.16
7.3.290.0140.00316.38
7.3.280.0080.00916.31
7.3.270.0100.01417.40
7.3.260.0040.01216.63
7.3.250.0100.00816.58
7.3.240.0070.01116.61
7.3.230.0060.01116.39
7.3.210.0080.01216.62
7.3.200.0100.00719.39
7.3.190.0040.01516.28
7.3.180.0100.01316.30
7.3.170.0100.01016.39
7.3.160.0080.01516.36
7.3.120.0030.01415.02
7.2.330.0120.00616.69
7.2.320.0070.01016.69
7.2.310.0170.00316.48
7.2.300.0120.00616.87
7.2.290.0110.00616.72
7.1.200.0030.01015.67
7.1.70.0040.00416.84
7.1.60.0060.00619.29
7.1.50.0030.01017.09
7.1.00.0070.07322.48
7.0.200.0000.00816.87
7.0.140.0070.07022.18
7.0.60.0070.06319.95
7.0.50.0030.04017.66
7.0.40.0100.04020.02
7.0.30.0200.04720.13
7.0.20.0300.06720.45
7.0.10.0270.07720.24
7.0.00.0030.08720.13
5.6.280.0030.07321.04
5.6.210.0100.08020.72
5.6.200.0030.08318.22
5.6.190.0000.08320.45
5.6.180.0030.08720.39
5.6.170.0270.06320.50
5.6.160.0070.06020.50
5.6.150.0070.08018.09
5.6.140.0030.04018.16
5.6.130.0100.05018.21
5.6.120.0130.07720.96
5.6.110.0400.07320.91
5.6.100.0100.07720.99
5.6.90.0170.07720.96
5.6.80.0130.07020.28
5.6.70.0470.07020.50
5.5.350.0030.06020.40
5.5.340.0030.05717.98
5.5.330.0030.09020.41
5.5.320.0030.04020.24
5.5.310.0170.04020.29
5.5.300.0100.08017.91
5.5.290.0030.08318.01
5.5.280.0000.08720.79
5.5.270.0130.07720.86
5.5.260.0170.06020.86
5.5.250.0170.04020.49
5.5.240.0070.07720.20
5.4.450.1030.04719.25
5.4.440.0700.05319.49
5.4.430.0200.07019.40
5.4.420.0770.07019.13
5.4.410.0700.05019.39
5.4.400.0370.06318.82
5.4.390.0570.05719.25
5.4.380.0200.05018.61
5.4.370.0130.05718.54
5.4.360.0230.04018.51
5.4.350.0200.05318.72
5.4.340.0300.04318.46
5.4.320.0050.03712.45
5.4.310.0060.03912.45
5.4.300.0110.04012.45
5.4.290.0070.04212.45
5.4.280.0060.03612.35
5.4.270.0070.04412.35
5.4.260.0050.04012.35
5.4.250.0070.04112.35
5.4.240.0100.03912.35
5.4.230.0070.03712.34
5.4.220.0090.05012.34
5.4.210.0130.05312.33
5.4.200.0180.04512.32
5.4.190.0180.04512.32
5.4.180.0220.06912.32
5.4.170.0130.04612.34
5.4.160.0120.04612.32
5.4.150.0180.04012.32
5.4.140.0130.04612.00
5.4.130.0110.04712.00
5.4.120.0160.04311.95
5.4.110.0180.04611.95
5.4.100.0190.04311.95
5.4.90.0160.04511.95
5.4.80.0340.08511.95
5.4.70.0150.04511.95
5.4.60.0150.04311.94
5.4.50.0170.04011.95
5.4.40.0170.04811.93
5.4.30.0180.04511.93
5.4.20.0240.04211.93
5.4.10.0330.12711.93
5.4.00.0280.06011.42
5.3.290.0070.05312.80
5.3.280.0050.04212.71
5.3.270.0240.05212.72
5.3.260.0420.09012.72
5.3.250.0180.05112.72
5.3.240.0210.05312.72
5.3.230.0330.09212.71
5.3.220.0190.04712.68
5.3.210.0220.04412.68
5.3.200.0170.04812.68
5.3.190.0200.04812.68
5.3.180.0450.08712.67
5.3.170.0190.04912.67
5.3.160.0280.04712.68
5.3.150.0180.04812.67
5.3.140.0170.05212.66
5.3.130.0210.07712.66
5.3.120.0190.04512.66
5.3.110.0190.05412.66
5.3.100.0210.04212.12
5.3.90.0190.04312.08
5.3.80.0160.04612.08
5.3.70.0140.04612.07
5.3.60.0130.04812.06
5.3.50.0340.09012.00
5.3.40.0160.04612.00
5.3.30.0140.04911.94
5.3.20.0150.05011.71
5.3.10.0150.04411.67
5.3.00.0180.04311.66
5.2.170.0230.0629.17
5.2.160.0170.0399.16
5.2.150.0140.0359.16
5.2.140.0210.0309.16
5.2.130.0250.0589.12
5.2.120.0140.0379.13
5.2.110.0130.0359.13
5.2.100.0160.0339.13
5.2.90.0380.0759.13
5.2.80.0130.0349.11
5.2.70.0100.0399.11
5.2.60.0120.0409.07
5.2.50.0090.0409.04
5.2.40.0150.0379.02
5.2.30.0150.0358.99
5.2.20.0160.0318.98
5.2.10.0240.0538.92
5.2.00.0140.0318.77
5.1.60.0120.0298.06
5.1.50.0150.0258.05
5.1.40.0090.0318.05
5.1.30.0130.0298.39
5.1.20.0150.0308.41
5.1.10.0080.0378.14
5.1.00.0080.0348.14
5.0.50.0270.0746.63
5.0.40.0130.0266.48
5.0.30.0130.0386.30
5.0.20.0130.0236.27
5.0.10.0110.0236.24
5.0.00.0110.0426.23
4.4.90.0220.0384.78
4.4.80.0080.0184.75
4.4.70.0060.0204.75
4.4.60.0090.0174.75
4.4.50.0080.0174.77
4.4.40.0100.0324.71
4.4.30.0100.0214.76
4.4.20.0080.0184.84
4.4.10.0070.0214.85
4.4.00.0080.0294.76
4.3.110.0080.0174.67
4.3.100.0070.0184.66
4.3.90.0060.0184.63
4.3.80.0070.0274.59
4.3.70.0060.0194.63
4.3.60.0090.0154.63
4.3.50.0080.0164.63
4.3.40.0080.0274.54
4.3.30.0040.0243.30
4.3.20.0060.0183.29
4.3.10.0200.0643.25
4.3.00.0130.01713.43

preferences:
50.63 ms | 401 KiB | 5 Q