3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Each person wants peaches for themselves forever"; $blacklist = array("for", "each"); //print_r($blacklist); // if you might have non-letter characters that have special meaning to the regex engine //$blacklist = array_map(function($v){return preg_quote($v, '/');}, $blacklist); //print_r($blacklist); echo "Without wordboundaries:\n"; var_export(preg_replace('/' . implode('|', $blacklist) . '/i', '', $string)); echo "\n\n---\n"; echo "With wordboundaries:\n"; var_export(preg_replace('/\b(?:' . implode('|', $blacklist) . ')\b/i', '', $string)); echo "\n\n---\n"; echo "With wordboundaries and consecutive space mop up:\n"; var_export(trim(preg_replace(array('/\b(?:' . implode('|', $blacklist) . ')\b/i', '/ \K +/'), '', $string)));

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.120.0090.01120.70
8.4.110.0170.00422.36
8.4.100.0130.00817.91
8.4.90.0130.00817.88
8.4.80.0120.00917.86
8.4.70.0100.01017.93
8.4.60.0130.00818.88
8.4.50.0090.00819.79
8.4.40.0140.00718.07
8.4.30.0160.00317.91
8.4.20.0110.01118.52
8.4.10.0120.00917.71
8.3.250.0120.00619.17
8.3.240.0120.00816.71
8.3.230.0110.00716.53
8.3.220.0100.01017.23
8.3.210.0100.01016.62
8.3.200.0070.00216.66
8.3.190.0090.00917.30
8.3.180.0130.00618.31
8.3.170.0100.00716.79
8.3.160.0040.01418.70
8.3.150.0070.00320.81
8.3.140.0030.00616.53
8.3.130.0120.00618.35
8.3.120.0060.00619.09
8.3.110.0040.00416.68
8.3.100.0100.01024.06
8.3.90.0090.00626.77
8.3.80.0030.00617.97
8.3.70.0070.00716.63
8.3.60.0130.00318.43
8.3.50.0080.00617.49
8.3.40.0190.00018.96
8.3.30.0070.00718.93
8.3.20.0040.00419.02
8.3.10.0030.00621.85
8.3.00.0040.00421.86
8.2.290.0040.00520.49
8.2.280.0030.00519.16
8.2.270.0050.00517.17
8.2.260.0030.00718.46
8.2.250.0100.00018.51
8.2.240.0100.00019.25
8.2.230.0040.00420.94
8.2.220.0070.01037.54
8.2.210.0040.00426.77
8.2.200.0030.00618.66
8.2.190.0130.00316.67
8.2.180.0040.01218.31
8.2.170.0070.00722.96
8.2.160.0070.00719.46
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0000.00822.21
8.2.120.0040.00726.35
8.2.110.0070.00322.41
8.2.100.0080.00417.97
8.2.90.0000.00817.75
8.2.80.0040.00417.97
8.2.70.0080.00017.93
8.2.60.0030.00618.09
8.2.50.0050.00318.10
8.2.40.0040.00421.18
8.2.30.0000.00720.53
8.2.20.0000.00718.00
8.2.10.0030.00519.94
8.2.00.0040.00419.34
8.1.330.0130.00622.13
8.1.320.0090.01017.97
8.1.310.0060.00318.54
8.1.300.0030.00616.61
8.1.290.0040.00430.84
8.1.280.0120.00625.92
8.1.270.0040.00420.43
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00019.21
8.1.230.0110.00417.76
8.1.220.0050.00317.74
8.1.210.0000.00918.77
8.1.200.0000.00817.48
8.1.190.0080.00017.47
8.1.180.0060.00318.10
8.1.170.0000.00818.61
8.1.160.0040.00418.92
8.1.150.0060.00318.91
8.1.140.0000.00718.93
8.1.130.0030.00320.21
8.1.120.0070.00017.50
8.1.110.0050.00517.59
8.1.100.0070.00017.60
8.1.90.0000.00817.48
8.1.80.0000.00817.51
8.1.70.0000.00717.65
8.1.60.0000.00817.75
8.1.50.0000.01117.64
8.1.40.0050.00317.56
8.1.30.0040.00417.86
8.1.20.0030.00617.71
8.1.10.0030.00617.57
8.1.00.0040.00417.49
8.0.300.0000.00818.77
8.0.290.0040.00416.88
8.0.280.0030.00318.47
8.0.270.0040.00417.29
8.0.260.0000.01118.44
8.0.250.0070.00017.08
8.0.240.0030.00617.11
8.0.230.0040.00417.08
8.0.220.0080.00017.06
8.0.210.0050.00216.97
8.0.200.0030.00317.11
8.0.190.0030.00517.11
8.0.180.0000.00916.99
8.0.170.0030.00617.04
8.0.160.0000.00817.09
8.0.150.0000.00717.04
8.0.140.0050.00216.89
8.0.130.0080.00013.55
8.0.120.0000.00716.87
8.0.110.0040.00416.94
8.0.100.0050.00216.87
8.0.90.0040.00417.05
8.0.80.0040.01316.99
8.0.70.0000.00816.90
8.0.60.0040.00416.91
8.0.50.0000.00717.01
8.0.30.0100.00917.35
8.0.20.0090.01017.40
8.0.10.0000.00817.19
8.0.00.0100.00916.74
7.4.330.0030.00315.55
7.4.320.0060.00016.82
7.4.300.0000.00616.85
7.4.290.0030.00316.86
7.4.280.0030.00516.80
7.4.270.0060.00316.86
7.4.260.0080.00416.71
7.4.250.0030.00516.59
7.4.240.0040.00416.65
7.4.230.0080.00016.75
7.4.220.0060.00316.93
7.4.210.0100.00916.74
7.4.200.0040.00416.60
7.4.160.0100.00716.75
7.4.140.0080.01117.86
7.4.130.0100.01316.70
7.4.120.0090.01016.69
7.4.110.0090.00916.71
7.4.100.0110.00816.59
7.4.90.0090.00916.60
7.4.80.0150.00319.39
7.4.70.0080.00816.47
7.4.60.0150.00516.70
7.4.50.0060.00916.42
7.4.40.0150.00316.83
7.4.10.0100.01015.24
7.4.00.0100.00515.11
7.3.330.0000.00613.19
7.3.320.0000.00513.14
7.3.310.0000.00716.20
7.3.300.0070.00016.24
7.3.290.0030.00316.25
7.3.280.0060.00916.34
7.3.260.0100.01016.49
7.3.240.0090.01116.57
7.3.230.0100.01016.62
7.3.210.0130.00616.61
7.3.200.0090.00916.36
7.3.190.0060.01016.28
7.3.180.0000.01616.71
7.3.170.0130.00316.61
7.3.160.0160.00616.64
7.3.130.0000.01214.91
7.3.120.0030.01314.63
7.3.110.0100.00714.75
7.3.100.0090.00314.89
7.3.90.0070.01014.86
7.3.80.0030.00614.82
7.3.70.0030.01214.97
7.3.60.0030.01014.85
7.3.50.0000.01114.93
7.3.40.0070.01014.74
7.3.30.0070.01114.75
7.3.20.0090.00316.82
7.3.10.0060.00916.88
7.3.00.0000.01316.40
7.2.330.0110.00616.49
7.2.320.0030.01416.75
7.2.310.0030.01316.92
7.2.300.0070.01016.89
7.2.290.0040.01416.82
7.2.260.0030.01215.15
7.2.250.0060.01315.31
7.2.240.0060.01015.22
7.2.230.0110.00415.01
7.2.220.0060.00915.24
7.2.210.0090.00915.36
7.2.200.0040.01415.31
7.2.190.0070.00715.29
7.2.180.0060.00615.34
7.2.170.0070.01015.32
7.2.160.0130.00714.70
7.2.150.0030.00916.83
7.2.140.0040.01216.89
7.2.130.0000.01617.15
7.2.120.0040.01116.91
7.2.110.0090.00616.94
7.2.100.0750.00615.84
7.2.90.0660.00915.67
7.2.80.0670.00715.84
7.2.70.0640.00815.97
7.2.60.0850.00515.96
7.2.50.0840.01116.01
7.2.40.0710.00216.07
7.2.30.0990.00716.22
7.2.20.0750.00616.13
7.2.10.0710.00916.14
7.2.00.0050.01117.13
7.1.330.0070.01016.12
7.1.320.0060.00315.88
7.1.310.0050.00515.87
7.1.300.0030.01015.63
7.1.290.0000.00916.05
7.1.280.0090.00915.86
7.1.270.0030.01115.77
7.1.260.0030.01416.14
7.1.250.0040.00815.59
7.1.240.0060.00615.83
7.1.230.0070.01015.88
7.1.220.0030.00615.52
7.1.210.0810.01014.95
7.1.200.0650.00614.93
7.1.190.0620.00814.76
7.1.180.0840.00414.96
7.1.170.0850.00815.03
7.1.160.0870.01014.88
7.1.150.0670.00915.06
7.1.140.0650.00714.97
7.1.130.0250.01015.77
7.1.120.0060.00915.77
7.1.110.0050.00915.56
7.1.100.0070.00415.82
7.1.90.0080.00715.78
7.1.80.0070.00715.77
7.1.70.0050.01015.92
7.1.60.0170.00924.73
7.1.50.0140.01024.79
7.1.40.0110.01524.61
7.1.30.0170.00824.59
7.1.20.0150.00924.34
7.1.10.0100.00315.73
7.1.00.0060.00816.00
7.0.330.0030.00715.31
7.0.320.0030.01215.78
7.0.310.0040.00715.54
7.0.300.0090.00615.38
7.0.290.0070.01015.49
7.0.280.0120.00315.36
7.0.270.0030.01615.25
7.0.260.0130.00015.23
7.0.250.0060.00315.52
7.0.240.0030.00615.48
7.0.230.0000.01215.79
7.0.220.0000.00915.39
7.0.210.0090.00615.79
7.0.200.0100.00315.47
7.0.190.0050.00515.42
7.0.180.0060.00315.39
7.0.170.0000.01315.73
7.0.160.0090.00015.45
7.0.150.0090.00615.58
7.0.140.0100.00315.49
7.0.130.0040.00715.33
7.0.120.0060.00615.61
7.0.110.0030.01315.34
7.0.100.0060.00315.54
7.0.90.0000.01315.54
7.0.80.0040.00715.32
7.0.70.0060.00315.66
7.0.60.0030.00615.53
7.0.50.0120.00315.61
7.0.40.0090.00313.66
7.0.30.0040.01113.76
7.0.20.0070.00713.63
7.0.10.0060.00313.63
7.0.00.0040.00713.29
5.6.400.0070.00714.50
5.6.390.0070.00414.46
5.6.380.0030.01314.44
5.6.370.0110.00414.27
5.6.360.0060.00914.34
5.6.350.0080.00414.19
5.6.340.0030.01014.18
5.6.330.0090.00314.32
5.6.320.0060.00614.36
5.6.310.0060.00314.56
5.6.300.0070.00714.65
5.6.290.0060.00314.41
5.6.280.0100.00714.51
5.6.270.0040.01214.56
5.6.260.0030.01014.08
5.6.250.0120.00314.63
5.6.240.0080.00414.16
5.6.230.0060.00914.39
5.6.220.0060.00614.68
5.6.210.0000.01214.64
5.6.200.0070.00314.49
5.6.190.0030.01014.30
5.6.180.0030.01114.44
5.6.170.0030.01014.36
5.6.160.0030.00914.13
5.6.150.0120.00314.55
5.6.140.0030.01014.48
5.6.130.0000.01314.65
5.6.120.0030.01014.46
5.6.110.0040.00414.20
5.6.100.0100.00314.61
5.6.90.0060.00614.28
5.6.80.0060.00614.05
5.6.70.0060.00614.30
5.6.60.0070.00414.15
5.6.50.0070.00714.46
5.6.40.0030.00614.00
5.6.30.0060.00614.48
5.6.20.0040.00714.61
5.6.10.0030.00714.29
5.6.00.0120.00314.49

preferences:
135.37 ms | 403 KiB | 5 Q