3v4l.org

run code in 300+ PHP versions simultaneously
<?php $badwords = array('dog', 'dala', 'bad3', 'ass'); $text = 'This is a dog. . Grass. is good but ass is bad.'; print_r( filterBadwords($text,$badwords)); function filterBadwords($text, array $badwords, $replaceChar = '*') { $match_found = false; $repu = preg_replace_callback(array_map(function($w) { return '/\b' . preg_quote($w, '/') . '\b/i'; }, $badwords), function($match) use ($replaceChar) { $match_found = true; return str_repeat($replaceChar, strlen($match[0])); }, $text ); return array('error' =>$match_found, 'text' => $repu ); }

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.0070.01417.00
8.3.50.0110.00316.84
8.3.40.0120.00318.89
8.3.30.0110.00418.79
8.3.20.0040.00420.18
8.3.10.0000.00823.61
8.3.00.0070.00023.62
8.2.180.0090.00918.79
8.2.170.0190.00019.03
8.2.160.0070.00722.96
8.2.150.0140.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00422.10
8.2.120.0040.00426.35
8.2.110.0030.00622.43
8.2.100.0040.00718.22
8.2.90.0050.00318.02
8.2.80.0080.00017.97
8.2.70.0080.00018.05
8.2.60.0080.00018.22
8.2.50.0030.00618.10
8.2.40.0080.00020.42
8.2.30.0030.00621.00
8.2.20.0000.00818.10
8.2.10.0000.00818.30
8.2.00.0070.00018.30
8.1.280.0120.00325.92
8.1.270.0050.00323.96
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00320.77
8.1.230.0050.00521.07
8.1.220.0040.00417.79
8.1.210.0030.00618.84
8.1.200.0060.00317.38
8.1.190.0030.00717.48
8.1.180.0060.00318.10
8.1.170.0080.00318.87
8.1.160.0070.00019.05
8.1.150.0000.00718.99
8.1.140.0030.00517.63
8.1.130.0000.00719.01
8.1.120.0000.00717.66
8.1.110.0020.00517.62
8.1.100.0030.00617.63
8.1.90.0000.00817.68
8.1.80.0000.00817.63
8.1.70.0050.00217.67
8.1.60.0050.00317.78
8.1.50.0030.00617.57
8.1.40.0030.00617.72
8.1.30.0030.00717.73
8.1.20.0000.00817.82
8.1.10.0000.00817.69
8.1.00.0040.00417.71
8.0.300.0040.00421.61
8.0.290.0090.00017.00
8.0.280.0000.00718.50
8.0.270.0070.00017.31
8.0.260.0020.00516.87
8.0.250.0070.00017.04
8.0.240.0000.00817.00
8.0.230.0070.00017.01
8.0.220.0030.00317.13
8.0.210.0070.00016.93
8.0.200.0030.00317.12
8.0.190.0060.00617.09
8.0.180.0040.00417.06
8.0.170.0070.00017.06
8.0.160.0030.00517.09
8.0.150.0050.00517.02
8.0.140.0040.00416.94
8.0.130.0070.00013.49
8.0.120.0030.00616.94
8.0.110.0040.00416.92
8.0.100.0000.00717.05
8.0.90.0000.00717.06
8.0.80.0110.01117.00
8.0.70.0000.00716.96
8.0.60.0000.00817.19
8.0.50.0020.00516.97
8.0.30.0160.00317.25
8.0.20.0120.01117.43
8.0.10.0050.00217.24
8.0.00.0100.01017.20
7.4.330.0050.00016.68
7.4.320.0050.00216.74
7.4.300.0030.00316.76
7.4.290.0000.00816.64
7.4.280.0000.00716.88
7.4.270.0070.00016.60
7.4.260.0000.00716.72
7.4.250.0040.00416.70
7.4.240.0000.00816.65
7.4.230.0030.00316.64
7.4.220.0000.00816.85
7.4.210.0110.00316.86
7.4.200.0040.00416.87
7.4.160.0110.00516.73
7.4.150.0060.01417.40
7.4.140.0120.00717.86
7.4.130.0080.01816.65
7.4.120.0080.01316.69
7.4.110.0030.01316.75
7.4.100.0170.00916.90
7.4.90.0140.00316.51
7.4.80.0130.01019.39
7.4.70.0110.01116.75
7.4.60.0090.00616.73
7.4.50.0040.01116.73
7.4.40.0070.01016.65
7.4.30.0130.00916.76
7.4.00.0090.00615.02
7.3.330.0050.00013.48
7.3.320.0000.00513.48
7.3.310.0030.00316.43
7.3.300.0030.00316.58
7.3.290.0110.00516.54
7.3.280.0070.00916.52
7.3.270.0170.00017.40
7.3.260.0080.00916.54
7.3.250.0110.00816.57
7.3.240.0180.00516.78
7.3.230.0080.01516.50
7.3.210.0070.01016.52
7.3.200.0090.00916.50
7.3.190.0130.00416.48
7.3.180.0040.01216.79
7.3.170.0130.00616.63
7.3.160.0080.01116.89
7.2.330.0040.01416.81
7.2.320.0090.00716.77
7.2.310.0080.01216.84
7.2.300.0070.01116.65
7.2.290.0090.00916.74
7.2.60.0100.00316.90
7.1.200.0000.00715.84
7.1.110.0130.00318.10
7.1.100.0080.00818.29
7.1.90.0060.01018.44
7.1.80.0060.00918.56
7.1.70.0030.01417.13
7.1.60.0230.01534.89
7.1.50.0210.00934.63
7.1.40.0140.01734.30
7.1.30.0200.01734.32
7.1.20.0100.02034.55
7.1.10.0060.01516.93
7.1.00.0030.01416.98
7.0.250.0000.01617.89
7.0.240.0030.01318.14
7.0.230.0070.01218.26
7.0.220.0030.01217.82
7.0.210.0040.01516.79
7.0.200.0090.00616.97
7.0.190.0060.00917.07
7.0.180.0060.01216.43
7.0.170.0070.01016.46
7.0.160.0060.01416.37
7.0.150.0060.01116.38
7.0.140.0060.01216.58
7.0.130.0050.00816.50
7.0.120.0040.00816.64
7.0.110.0060.01516.38
7.0.100.0100.01016.55
7.0.90.0090.00616.73
7.0.80.0060.00916.82
7.0.70.0100.01016.42
7.0.60.0030.01216.45
7.0.50.0110.00416.33
7.0.40.0090.00616.57
7.0.30.0040.01216.57
7.0.20.0100.01016.70
7.0.10.0030.01616.66
7.0.00.0060.01316.55

preferences:
65.49 ms | 400 KiB | 5 Q