3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 'blue' => 43, 'red' => 87, 'purple' => 130, 'green' => 12, 'yellow' => 31 ]; $bad_keys1 = [ 'purple', 'yellow', ]; $bad_keys2 = [ 'green', ]; function remove_blacklisted_keys(array $haystack, array ...$blacklists) { return array_diff_key($haystack, array_flip(array_merge(...$blacklists))); } function remove_blacklisted_keys_preflipped(array $haystack, array ...$blacklists) { return array_diff_key($haystack, ...$blacklists); } var_export(remove_blacklisted_keys($data, $bad_keys1)); echo "\n"; var_export(remove_blacklisted_keys($data, $bad_keys1, $bad_keys2)); echo "\n"; var_export(remove_blacklisted_keys_preflipped($data, array_flip($bad_keys1))); echo "\n"; var_export(remove_blacklisted_keys_preflipped($data, array_flip($bad_keys1), array_flip($bad_keys2)));

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.5.30.0100.00819.51
8.5.20.0080.01018.56
8.5.10.0180.00816.54
8.5.00.0200.01120.04
8.4.180.0150.00922.07
8.4.170.0150.00623.80
8.4.160.0160.00723.87
8.4.150.0070.00716.84
8.4.140.0140.00717.75
8.4.130.0090.00617.56
8.4.120.0090.01120.69
8.4.110.0150.00618.82
8.4.100.0130.00817.79
8.4.90.0120.00920.65
8.4.80.0060.00218.88
8.4.70.0080.00319.18
8.4.60.0110.00920.63
8.4.50.0070.00119.67
8.4.40.0030.01717.54
8.4.30.0070.01318.84
8.4.20.0100.01019.67
8.4.10.0100.00719.26
8.3.300.0130.00719.05
8.3.290.0160.00520.93
8.3.280.0080.00316.27
8.3.270.0100.00916.49
8.3.260.0060.00516.41
8.3.250.0100.00518.90
8.3.240.0140.00516.54
8.3.230.0090.00716.67
8.3.220.0050.00218.79
8.3.210.0050.01016.58
8.3.200.0050.00416.42
8.3.190.0110.00816.68
8.3.180.0070.00718.79
8.3.170.0120.00817.03
8.3.160.0060.01318.30
8.3.150.0030.00520.57
8.3.140.0060.00320.67
8.3.130.0040.01418.08
8.3.120.0070.01018.87
8.3.110.0030.00620.94
8.3.100.0080.00018.35
8.3.90.0040.00426.77
8.3.80.0000.00918.30
8.3.70.0060.01316.58
8.3.60.0110.00718.18
8.3.50.0040.01116.59
8.3.40.0030.01223.54
8.3.30.0180.00319.26
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0050.00226.16
8.2.300.0150.00720.31
8.2.290.0100.00916.93
8.2.280.0090.01018.40
8.2.270.0000.01817.13
8.2.260.0070.00419.06
8.2.250.0050.00518.27
8.2.240.0000.00817.20
8.2.230.0070.00722.58
8.2.220.0080.00024.06
8.2.210.0150.00426.77
8.2.200.0060.00316.50
8.2.190.0140.00716.58
8.2.180.0110.00725.92
8.2.170.0140.01018.79
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0080.00019.77
8.2.110.0030.00719.30
8.2.100.0340.00018.44
8.2.90.0270.00218.44
8.2.80.0270.00318.44
8.2.70.0240.00618.44
8.2.60.0180.01118.44
8.2.50.0290.00018.44
8.2.40.0260.00018.44
8.2.30.0210.00618.44
8.2.20.0180.00918.44
8.2.10.0180.00718.44
8.2.00.0140.01418.44
8.1.340.0140.00817.61
8.1.330.0150.00416.18
8.1.320.0120.00817.84
8.1.310.0040.00416.82
8.1.300.0070.01018.10
8.1.290.0060.00330.84
8.1.280.0110.00425.92
8.1.270.0060.01023.82
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00623.92
8.1.230.0210.00518.44
8.1.220.0260.00218.44
8.1.210.0250.00418.44
8.1.200.0200.00818.44
8.1.190.0230.00318.44
8.1.180.0160.01018.44
8.1.170.0130.01318.44
8.1.160.0230.00418.44
8.1.150.0240.00218.44
8.1.140.0220.00518.44
8.1.130.0200.00718.44
8.1.120.0170.01018.44
8.1.110.0230.00318.44
8.1.100.0200.00818.44
8.1.90.0190.00818.44
8.1.80.0270.00018.44
8.1.70.0270.00318.44
8.1.60.0230.01318.44
8.1.50.0210.00618.44
8.1.40.0150.00918.44
8.1.30.0270.00018.44
8.1.20.0150.01218.44
8.1.10.0220.00418.44
8.1.00.0160.00818.44
8.0.300.0220.00018.44
8.0.290.0230.00418.44
8.0.280.0220.00518.44
8.0.270.0280.00018.44
8.0.260.0260.00318.44
8.0.250.0220.00618.44
8.0.240.0230.00418.44
8.0.230.0240.00318.44
8.0.220.0240.00318.44
8.0.210.0260.00018.44
8.0.200.0200.00718.44
8.0.190.0190.00718.44
8.0.180.0220.00418.44
8.0.170.0150.01118.44
8.0.160.0220.00618.44
8.0.150.0150.00718.44
8.0.140.0160.01018.44
8.0.130.0170.00418.44
8.0.120.0260.00018.44
8.0.110.0190.00618.44
8.0.100.0190.00818.44
8.0.90.0190.00718.44
8.0.80.0170.00618.44
8.0.70.0250.00418.44
8.0.60.0240.00418.44
8.0.50.0270.00018.44
8.0.30.0260.00318.44
8.0.20.0290.00418.44
8.0.10.0280.00318.44

preferences:
44.78 ms | 1137 KiB | 5 Q