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(str_icmp($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.60.0100.00717.00
8.3.50.0070.00716.41
8.3.40.0140.00319.01
8.3.30.0110.00419.01
8.3.20.0030.00520.20
8.3.10.0080.00023.64
8.3.00.0040.00423.45
8.2.180.0120.00618.79
8.2.170.0120.00319.12
8.2.160.0100.00322.96
8.2.150.0050.00325.66
8.2.140.0030.00624.66
8.2.130.0070.00722.26
8.2.120.0080.00026.35
8.2.110.0030.00620.53
8.2.100.0090.00317.97
8.2.90.0050.00319.30
8.2.80.0030.00518.00
8.2.70.0050.00318.00
8.2.60.0080.00017.93
8.2.50.0030.00718.10
8.2.40.0060.00320.61
8.2.30.0030.00521.04
8.2.20.0000.00718.35
8.2.10.0070.00018.35
8.2.00.0000.00718.13
8.1.280.0150.00025.92
8.1.270.0040.00424.01
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00022.32
8.1.230.0070.00417.89
8.1.220.0030.00517.74
8.1.210.0030.00518.77
8.1.200.0060.00317.48
8.1.190.0050.00317.48
8.1.180.0050.00318.10
8.1.170.0050.00318.69
8.1.160.0030.00518.94
8.1.150.0040.00418.93
8.1.140.0040.00417.73
8.1.130.0040.00418.93
8.1.120.0050.00217.68
8.1.110.0060.00317.62
8.1.100.0000.00717.59
8.1.90.0000.00717.54
8.1.80.0040.00417.65
8.1.70.0000.00717.68
8.1.60.0000.00817.79
8.1.50.0040.00417.70
8.1.40.0030.00617.66
8.1.30.0040.00417.84
8.1.20.0040.00417.82
8.1.10.0030.00517.67
8.1.00.0000.00817.69
8.0.300.0030.00518.77
8.0.290.0000.00717.13
8.0.280.0070.00018.48
8.0.270.0070.00017.31
8.0.260.0050.00516.95
8.0.250.0070.00017.09
8.0.240.0040.00417.09
8.0.230.0070.00017.08
8.0.220.0030.00517.03
8.0.210.0000.00717.19
8.0.200.0000.00717.14
8.0.190.0060.00517.07
8.0.180.0070.00017.13
8.0.170.0000.00717.07
8.0.160.0000.00717.18
8.0.150.0000.01017.07
8.0.140.0030.00517.04
8.0.130.0060.00313.59
8.0.120.0060.00316.99
8.0.110.0040.00417.16
8.0.100.0040.00417.11
8.0.90.0070.00016.95
8.0.80.0130.00917.15
8.0.70.0050.00317.02
8.0.60.0080.00016.93
8.0.50.0030.00617.02
8.0.30.0100.00717.45
8.0.20.0140.00617.45
8.0.10.0060.00317.16
8.0.00.0120.00916.96
7.4.330.0060.00016.64
7.4.320.0030.00316.86
7.4.300.0030.00316.83
7.4.290.0030.00316.66
7.4.280.0000.00816.82
7.4.270.0070.00016.69
7.4.260.0070.00016.86
7.4.250.0000.00716.70
7.4.240.0040.00416.72
7.4.230.0070.00016.82
7.4.220.0180.00916.65
7.4.210.0140.00016.70
7.4.200.0030.00516.82
7.4.160.0120.00516.77
7.4.150.0130.00617.40
7.4.140.0130.00817.86
7.4.130.0170.00716.69
7.4.120.0140.00516.81
7.4.110.0130.00316.63
7.4.100.0030.01616.93
7.4.90.0090.00916.69
7.4.80.0110.00719.39
7.4.70.0120.00616.96
7.4.60.0090.00816.64
7.4.50.0060.00916.71
7.4.40.0100.00716.74
7.4.30.0100.01016.86
7.4.10.0060.01115.21
7.4.00.0070.00715.32
7.3.330.0000.00613.53
7.3.320.0000.00613.51
7.3.310.0030.00316.57
7.3.300.0030.00316.60
7.3.290.0090.00616.55
7.3.280.0070.00916.50
7.3.270.0200.03017.40
7.3.260.0090.01016.70
7.3.250.0090.01016.60
7.3.240.0060.01116.57
7.3.230.0110.00816.71
7.3.210.0120.00416.67
7.3.200.0070.01016.60
7.3.190.0090.00916.55
7.3.180.0060.01016.88
7.3.170.0100.00716.59
7.3.160.0120.01216.64
7.3.130.0070.01215.23
7.3.120.0100.00815.02
7.3.110.0080.00914.97
7.3.100.0040.00915.04
7.3.90.0080.00415.16
7.3.80.0060.00814.85
7.3.70.0070.00914.92
7.3.60.0040.00915.07
7.3.50.0100.00215.05
7.3.40.0040.00915.08
7.3.30.0090.00615.11
7.3.20.0020.01216.82
7.3.10.0030.01016.90
7.3.00.0080.00817.03
7.2.330.0060.01316.79
7.2.320.0090.00616.83
7.2.310.0060.01216.95
7.2.300.0060.01216.98
7.2.290.0170.00316.83
7.2.260.0060.01015.24
7.2.250.0090.00915.35
7.2.240.0020.01315.21
7.2.230.0050.01015.21
7.2.220.0090.00415.34
7.2.210.0080.00814.97
7.2.200.0030.00915.26
7.2.190.0080.00515.25
7.2.180.0070.00714.96
7.2.170.0050.00415.21
7.2.160.0070.00515.00
7.2.150.0100.00517.05
7.2.140.0100.00317.10
7.2.130.0100.00817.06
7.2.120.0030.00917.04
7.2.110.0070.00716.92
7.2.100.0090.00617.08
7.2.90.0050.00916.90
7.2.80.0040.00917.00
7.2.70.0050.00617.17
7.2.60.0060.00717.01
7.2.50.0070.00716.87
7.2.40.0060.00617.21
7.2.30.0080.00717.25
7.2.20.0080.00417.10
7.2.10.0080.00816.91
7.2.00.0090.00617.04
7.1.330.0030.01215.83
7.1.320.0050.00915.81
7.1.310.0050.00516.01
7.1.300.0080.00616.04
7.1.290.0060.00715.84
7.1.280.0070.00115.92
7.1.270.0070.00515.88
7.1.260.0030.00815.86
7.1.250.0050.01015.85
7.1.240.0050.01015.87
7.1.230.0050.00916.04
7.1.220.0060.00515.94
7.1.210.0050.00816.03
7.1.200.0060.00616.00
7.1.190.0050.00916.01
7.1.180.0100.00515.89
7.1.170.0030.01015.88
7.1.160.0040.01115.94
7.1.150.0050.00916.06
7.1.140.0030.00915.99
7.1.130.0070.00715.98
7.1.120.0100.00216.03
7.1.110.0110.00616.24
7.1.100.0130.01016.25
7.1.90.0110.00816.09
7.1.80.0110.00916.39
7.1.70.0070.01115.86
7.1.60.0210.00921.77
7.1.50.0160.01521.60
7.1.40.0150.00821.54
7.1.30.0190.01021.48
7.1.20.0150.01121.51
7.1.10.0140.00715.49
7.1.00.0100.00715.71
7.0.330.0080.00615.58
7.0.320.0080.00615.61
7.0.310.0050.00815.62
7.0.300.0050.00515.45
7.0.290.0050.01015.58
7.0.280.0000.01315.60
7.0.270.0030.00815.46
7.0.260.0080.00215.60
7.0.250.0120.01115.82
7.0.240.0150.00815.91
7.0.230.0090.01015.96
7.0.220.0150.00415.77
7.0.210.0110.00715.44
7.0.200.0360.00715.48
7.0.190.0110.00715.49
7.0.180.0130.00815.26
7.0.170.0120.00715.13
7.0.160.0150.00815.35
7.0.150.0100.01115.21
7.0.140.0090.00915.28
7.0.130.0080.00815.41
7.0.120.0130.00415.42
7.0.110.0130.00715.27
7.0.100.0130.00715.30
7.0.90.0120.01015.27
7.0.80.0120.00815.42
7.0.70.0120.01015.27
7.0.60.0120.01015.06
7.0.50.0070.01115.20
7.0.40.0110.01114.05
7.0.30.0140.00814.01
7.0.20.0120.01113.92
7.0.10.0270.00813.93
7.0.00.0140.00814.10
5.6.400.0090.00314.56
5.6.390.0020.01114.36
5.6.380.0040.00814.30
5.6.370.0030.00814.48
5.6.360.0050.00714.56
5.6.350.0090.00514.43
5.6.340.0070.00714.15
5.6.330.0020.01014.25
5.6.320.0050.00514.52
5.6.310.0080.00514.16
5.6.300.0070.00814.68
5.6.290.0020.01114.68
5.6.280.0050.00714.42
5.6.270.0000.01214.69
5.6.260.0040.01014.49
5.6.250.0020.00814.56
5.6.240.0080.00814.45
5.6.230.0050.00914.42
5.6.220.0060.00614.53
5.6.210.0020.01114.57
5.6.200.0090.00714.45
5.6.190.0060.01014.58
5.6.180.0060.01114.36
5.6.170.0030.01014.38
5.6.160.0050.00914.36
5.6.150.0020.01014.29
5.6.140.0080.00514.46
5.6.130.0070.00814.40
5.6.120.0090.00414.25
5.6.110.0080.00614.38
5.6.100.0030.00714.37
5.6.90.0050.00814.68
5.6.80.0050.01214.20
5.6.70.0070.01114.43
5.6.60.0070.00614.32
5.6.50.0070.01014.40
5.6.40.0040.00914.52
5.6.30.0070.00514.37
5.6.20.0070.00414.27
5.6.10.0070.00814.64
5.6.00.0030.00914.38

preferences:
57.21 ms | 400 KiB | 5 Q