3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = ['3' => '4', '4' => '5', '1' => '2']; $allowed = ['1', '2', '3']; $flipAllowed = array_flip($allowed); var_export( array_replace( array_intersect_key($flipAllowed, $input), // filtered allowed array_intersect_key($input, $flipAllowed) // filtered input ) );

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.4.140.0160.00517.43
8.4.130.0120.00717.72
8.4.120.0090.01220.38
8.4.110.0140.00722.35
8.4.100.0100.00618.56
8.4.90.0070.00620.38
8.4.80.0030.00620.25
8.4.70.0140.00917.83
8.4.60.0130.00718.62
8.4.50.0110.00918.41
8.4.40.0060.01319.38
8.4.30.0140.00718.74
8.4.20.0090.01217.91
8.4.10.0060.00322.03
8.3.270.0100.00916.74
8.3.260.0110.00816.69
8.3.250.0110.00818.70
8.3.240.0120.00816.47
8.3.230.0110.00816.21
8.3.220.0110.00518.86
8.3.210.0030.00516.45
8.3.200.0080.00116.41
8.3.190.0020.00517.00
8.3.180.0040.00416.50
8.3.170.0090.00920.89
8.3.160.0070.00318.23
8.3.150.0110.00718.88
8.3.140.0060.00316.46
8.3.130.0030.00618.46
8.3.120.0060.00318.74
8.3.110.0160.00320.94
8.3.100.0090.00018.43
8.3.90.0080.00026.77
8.3.80.0090.00016.63
8.3.70.0040.01116.63
8.3.60.0190.00616.32
8.3.50.0070.01019.94
8.3.40.0090.00918.57
8.3.30.0100.00319.10
8.3.20.0070.00024.18
8.3.10.0030.00524.66
8.3.00.0070.00026.16
8.2.290.0090.00920.08
8.2.280.0110.00718.52
8.2.270.0090.00917.02
8.2.260.0070.00718.84
8.2.250.0050.00316.72
8.2.240.0030.00516.96
8.2.230.0090.00022.58
8.2.220.0030.00624.06
8.2.210.0040.00426.77
8.2.200.0070.00318.04
8.2.190.0120.00918.54
8.2.180.0100.00725.92
8.2.170.0140.00718.91
8.2.160.0150.00622.96
8.2.150.0080.00025.66
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00018.39
8.2.110.0040.00422.22
8.2.100.0110.00017.71
8.2.90.0050.00319.05
8.2.80.0050.00317.97
8.2.70.0000.00817.25
8.2.60.0030.00517.91
8.2.50.0060.00318.07
8.2.40.0000.00819.88
8.2.30.0080.00018.01
8.2.20.0070.00020.53
8.2.10.0080.00018.06
8.2.00.0030.00619.24
8.1.330.0040.00621.84
8.1.320.0110.00816.26
8.1.310.0110.00318.24
8.1.300.0000.00818.54
8.1.290.0100.00030.84
8.1.280.0090.00625.92
8.1.270.0060.00322.20
8.1.260.0100.00328.09
8.1.250.0000.00828.09
8.1.240.0050.00520.70
8.1.230.0040.00720.88
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.23
8.1.190.0040.00417.11
8.1.180.0000.00818.10
8.1.170.0060.00318.53
8.1.160.0050.00318.84
8.1.150.0080.00018.64
8.1.140.0030.00517.35
8.1.130.0030.00318.87
8.1.120.0050.00217.38
8.1.110.0020.00517.45
8.1.100.0050.00317.28
8.1.90.0050.00217.32
8.1.80.0000.00917.29
8.1.70.0000.00717.31
8.1.60.0040.00417.48
8.1.50.0200.00717.38
8.1.40.0240.00317.45
8.1.30.0210.00317.63
8.1.20.0180.00617.51
8.1.10.0130.01017.39
8.1.00.0240.00017.36
8.0.300.0070.00018.77
8.0.290.0080.00016.63
8.0.280.0060.00318.38
8.0.270.0000.00717.99
8.0.260.0000.00618.31
8.0.250.0040.00416.89
8.0.240.0040.00416.78
8.0.230.0000.00716.96
8.0.220.0040.00416.77
8.0.210.0040.00416.73
8.0.200.0000.00716.84
8.0.190.0000.00716.88
8.0.180.0080.00816.47
8.0.170.0090.00316.60
8.0.160.0160.00316.74
8.0.150.0140.00616.64
8.0.140.0110.01116.74
8.0.130.0190.00016.73
8.0.120.0130.00416.80
8.0.110.0120.00816.67
8.0.100.0100.00316.71
8.0.90.0110.00416.82
8.0.80.0060.00616.32
8.0.70.0060.00616.22
8.0.60.0070.00416.80
8.0.50.0080.00516.80
8.0.30.0090.00616.74
8.0.20.0190.00016.75
8.0.10.0110.00916.84
7.4.330.0030.00315.55
7.4.320.0000.00616.58
7.4.300.0030.00316.46
7.4.290.0210.00416.35
7.4.280.0240.00016.36
7.4.270.0130.00316.43
7.4.260.0030.00916.30
7.4.250.0110.00316.43
7.4.240.0170.00016.50
7.4.230.0140.00316.53
7.4.220.0070.00716.36
7.4.210.0170.00016.56
7.4.200.0100.00316.45
7.4.190.0060.00616.45
7.4.180.0080.00416.65
7.4.160.0090.00516.52
7.4.150.0090.00316.32
7.4.140.0090.00316.30
7.4.130.0040.00816.32
7.4.120.0080.00416.03
7.4.110.0000.01115.99
7.4.100.0150.00016.38
7.4.90.0130.00316.43
7.4.80.0050.00716.34
7.4.70.0110.00516.29
7.4.60.0100.00015.88
7.4.50.0070.00415.96
7.4.40.0040.00816.03
7.4.30.0090.00516.24
7.4.20.0080.00416.24
7.4.10.0040.00816.11
7.4.00.0090.00616.33

preferences:
33.34 ms | 403 KiB | 5 Q