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 = 0; $repu = preg_replace_callback(array_map(function($w) { return '/\b' . preg_quote($w, '/') . '\b/i'; }, $badwords), function($match) use ($replaceChar) { $match_found = 1; return str_repeat($replaceChar, strlen($match[0])); }, $text ); if(strcasecmp($repu,$text) === 0) echo "ok"; else echo "not ok"; 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.70.0110.00718.68
8.3.60.0090.00616.88
8.3.50.0140.00016.91
8.3.40.0040.01118.90
8.3.30.0080.00819.14
8.3.20.0000.00820.34
8.3.10.0050.00323.65
8.3.00.0000.00723.71
8.2.190.0080.00816.98
8.2.180.0110.00718.77
8.2.170.0120.00419.25
8.2.160.0070.01322.96
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0060.00322.24
8.2.120.0040.00426.35
8.2.110.0070.00321.12
8.2.100.0040.00817.97
8.2.90.0040.00419.21
8.2.80.0060.00317.97
8.2.70.0030.00617.75
8.2.60.0080.00018.05
8.2.50.0060.00318.16
8.2.40.0090.00020.50
8.2.30.0000.00821.18
8.2.20.0080.00018.12
8.2.10.0040.00418.24
8.2.00.0000.00818.12
8.1.280.0140.00425.92
8.1.270.0080.00024.00
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00021.18
8.1.230.0080.00417.77
8.1.220.0050.00317.78
8.1.210.0050.00518.77
8.1.200.0050.00517.60
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0080.00018.64
8.1.160.0040.00418.89
8.1.150.0040.00418.82
8.1.140.0040.00417.79
8.1.130.0030.00618.91
8.1.120.0030.00617.64
8.1.110.0040.00417.66
8.1.100.0000.00717.53
8.1.90.0000.00717.64
8.1.80.0040.00417.52
8.1.70.0000.00717.64
8.1.60.0090.00017.75
8.1.50.0000.00917.70
8.1.40.0090.00317.73
8.1.30.0040.00417.70
8.1.20.0040.00417.67
8.1.10.0040.00417.71
8.1.00.0000.00817.72
8.0.300.0040.00418.77
8.0.290.0050.00216.88
8.0.280.0000.00818.48
8.0.270.0000.00717.22
8.0.260.0030.00616.93
8.0.250.0060.00317.13
8.0.240.0050.00317.10
8.0.230.0000.00717.08
8.0.220.0000.00717.13
8.0.210.0000.00817.03
8.0.200.0030.00317.18
8.0.190.0070.00417.07
8.0.180.0000.00817.08
8.0.170.0070.00017.11
8.0.160.0040.00417.18
8.0.150.0000.00817.13
8.0.140.0000.00716.97
8.0.130.0080.00013.55
8.0.120.0040.00417.11
8.0.110.0040.00417.17
8.0.100.0000.00717.03
8.0.90.0050.00317.15
8.0.80.0130.01317.17
8.0.70.0050.00217.19
8.0.60.0000.00817.08
8.0.50.0040.00417.01
8.0.30.0090.01017.46
8.0.20.0110.00917.42
8.0.10.0040.00417.30
8.0.00.0120.00617.11
7.4.330.0020.00216.80
7.4.320.0040.00416.75
7.4.300.0070.00016.86
7.4.290.0040.00416.72
7.4.280.0040.00416.86
7.4.270.0000.00816.82
7.4.260.0000.00716.68
7.4.250.0030.00316.70
7.4.240.0030.00316.60
7.4.230.0030.00316.95
7.4.220.0110.01416.65
7.4.210.0120.00816.86
7.4.200.0040.00416.65
7.4.160.0080.01016.62
7.4.150.0040.01717.40
7.4.140.0100.01217.86
7.4.130.0090.01416.77
7.4.120.0100.00816.71
7.4.110.0120.01216.80
7.4.100.0190.00016.86
7.4.90.0120.01216.71
7.4.80.0110.00619.39
7.4.70.0030.01316.74
7.4.60.0110.00416.88
7.4.50.0060.00916.56
7.4.40.0090.00616.48
7.4.30.0100.01016.91
7.4.00.0120.00315.34
7.3.330.0030.00313.53
7.3.320.0060.00013.41
7.3.310.0030.00316.55
7.3.300.0030.00316.46
7.3.290.0100.00616.54
7.3.280.0070.01016.58
7.3.270.0140.00317.40
7.3.260.0110.00816.72
7.3.250.0120.00916.68
7.3.240.0100.01016.57
7.3.230.0090.00916.50
7.3.210.0030.01416.65
7.3.200.0080.00816.59
7.3.190.0100.01016.73
7.3.180.0090.00616.54
7.3.170.0030.01716.75
7.3.160.0090.01216.90
7.3.10.0040.00716.95
7.3.00.0070.00716.64
7.2.330.0130.00316.70
7.2.320.0120.00416.91
7.2.310.0140.00316.92
7.2.300.0100.01316.70
7.2.290.0030.01716.99
7.2.130.0030.01217.31
7.2.120.0110.00017.24
7.2.110.0030.01017.13
7.2.100.0040.00817.19
7.2.90.0000.01316.96
7.2.80.0090.00617.34
7.2.70.0070.00717.18
7.2.60.0080.00617.02
7.2.50.0000.01116.86
7.2.40.0000.01517.14
7.2.30.0030.01017.05
7.2.20.0060.00917.22
7.2.10.0040.00717.12
7.2.00.0060.00917.16
7.1.250.0130.00015.74
7.1.200.0000.01416.03
7.1.110.0030.01318.46
7.1.100.0070.01018.10
7.1.90.0120.00618.20
7.1.80.0060.01218.51
7.1.70.0040.01617.46
7.1.60.0240.01035.14
7.1.50.0170.01434.78
7.1.40.0200.01034.17
7.1.30.0160.01634.39
7.1.20.0270.01534.50
7.1.10.0080.01416.68
7.1.00.0060.01316.83
7.0.250.0090.00617.84
7.0.240.0050.01417.69
7.0.230.0080.01217.72
7.0.220.0180.00017.88
7.0.210.0070.01316.90
7.0.200.0150.00617.05
7.0.190.0060.01017.10
7.0.180.0060.01116.41
7.0.170.0120.00716.39
7.0.160.0090.01216.51
7.0.150.0030.01716.42
7.0.140.0020.01616.55
7.0.130.0040.01416.66
7.0.120.0000.01416.67
7.0.110.0080.01116.38
7.0.100.0120.00616.46
7.0.90.0080.01116.54
7.0.80.0000.01816.49
7.0.70.0030.01616.45
7.0.60.0030.01516.44
7.0.50.0040.01516.61
7.0.40.0060.01216.82
7.0.30.0080.00916.53
7.0.20.0140.00316.35
7.0.10.0120.00616.59
7.0.00.0030.01416.66

preferences:
70.86 ms | 401 KiB | 5 Q