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(stricmp($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.0090.00617.00
8.3.50.0090.00616.75
8.3.40.0090.00619.00
8.3.30.0110.00419.01
8.3.20.0040.00420.13
8.3.10.0060.00323.48
8.3.00.0080.00023.64
8.2.180.0070.01118.66
8.2.170.0130.00619.21
8.2.160.0000.01422.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0080.00022.33
8.2.120.0030.00526.35
8.2.110.0050.00522.38
8.2.100.0080.00418.16
8.2.90.0040.00420.01
8.2.80.0080.00017.97
8.2.70.0050.00517.93
8.2.60.0000.00818.28
8.2.50.0070.00418.10
8.2.40.0070.00020.55
8.2.30.0050.00321.16
8.2.20.0060.00318.31
8.2.10.0000.00718.25
8.2.00.0050.00218.12
8.1.280.0110.00325.92
8.1.270.0040.00423.96
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0060.00322.24
8.1.230.0080.00418.99
8.1.220.0030.00517.78
8.1.210.0000.00818.77
8.1.200.0030.00617.50
8.1.190.0000.00817.47
8.1.180.0060.00318.10
8.1.170.0040.00418.76
8.1.160.0000.00718.94
8.1.150.0000.00718.97
8.1.140.0000.00817.68
8.1.130.0030.00518.93
8.1.120.0050.00217.64
8.1.110.0050.00317.67
8.1.100.0000.00717.48
8.1.90.0000.00717.63
8.1.80.0000.00717.59
8.1.70.0050.00217.59
8.1.60.0000.00817.68
8.1.50.0040.00417.68
8.1.40.0040.00817.59
8.1.30.0060.00317.79
8.1.20.0000.00817.69
8.1.10.0030.00517.75
8.1.00.0000.00817.70
8.0.300.0000.00819.90
8.0.290.0040.00417.00
8.0.280.0070.00018.34
8.0.270.0030.00317.25
8.0.260.0030.00616.93
8.0.250.0040.00417.25
8.0.240.0080.00017.20
8.0.230.0030.00417.10
8.0.220.0030.00317.11
8.0.210.0030.00317.09
8.0.200.0060.00017.05
8.0.190.0030.00717.18
8.0.180.0000.00717.15
8.0.170.0080.00017.11
8.0.160.0000.00717.09
8.0.150.0070.00317.14
8.0.140.0070.00017.04
8.0.130.0080.00013.49
8.0.120.0000.00917.11
8.0.110.0000.00716.98
8.0.100.0020.00517.03
8.0.90.0030.00617.16
8.0.80.0070.01417.17
8.0.70.0070.00017.16
8.0.60.0040.00416.98
8.0.50.0040.00417.04
8.0.30.0120.00817.30
8.0.20.0130.00617.47
8.0.10.0050.00317.24
8.0.00.0060.01316.96
7.4.330.0050.00016.79
7.4.320.0000.00616.82
7.4.300.0000.00616.79
7.4.290.0080.00016.73
7.4.280.0070.00016.73
7.4.270.0030.00316.81
7.4.260.0000.00716.83
7.4.250.0070.00016.72
7.4.240.0000.00716.77
7.4.230.0050.00216.82
7.4.220.0100.01316.86
7.4.210.0090.00616.92
7.4.200.0070.00016.65
7.4.160.0110.00616.75
7.4.150.0060.01317.40
7.4.140.0110.00817.86
7.4.130.0190.00316.64
7.4.120.0110.00916.67
7.4.110.0140.01016.76
7.4.100.0150.00916.80
7.4.90.0180.00616.77
7.4.80.0120.00619.39
7.4.70.0000.02116.98
7.4.60.0090.00616.96
7.4.50.0060.01016.82
7.4.40.0060.01016.64
7.4.30.0120.00816.77
7.4.10.0080.01416.53
7.4.00.0080.00915.84
7.3.330.0000.00613.54
7.3.320.0060.00013.55
7.3.310.0000.00716.46
7.3.300.0040.00416.42
7.3.290.0060.01116.52
7.3.280.0090.00616.53
7.3.270.0190.00917.40
7.3.260.0100.00816.67
7.3.250.0110.00816.56
7.3.240.0130.00916.59
7.3.230.0120.00616.88
7.3.210.0080.00816.56
7.3.200.0090.00616.75
7.3.190.0090.00616.50
7.3.180.0130.00916.59
7.3.170.0100.00716.72
7.3.160.0130.00316.83
7.3.130.0130.00616.56
7.3.120.0080.00816.50
7.3.110.0100.00716.45
7.3.100.0070.00716.47
7.3.90.0060.01316.37
7.3.80.0120.00416.44
7.3.70.0030.01216.32
7.3.60.0110.00416.50
7.3.50.0080.00816.09
7.3.40.0140.00316.56
7.3.30.0110.00716.39
7.3.20.0110.00418.28
7.3.10.0080.00818.21
7.3.00.0160.00318.37
7.2.330.0030.01516.75
7.2.320.0070.01016.85
7.2.310.0160.00816.82
7.2.300.0130.00716.63
7.2.290.0030.01716.82
7.2.260.0060.01216.71
7.2.250.0150.00816.83
7.2.240.0030.01516.71
7.2.230.0070.01016.73
7.2.220.0070.01116.71
7.2.210.0070.01016.60
7.2.200.0040.01416.65
7.2.190.0110.00716.59
7.2.180.0100.00716.77
7.2.170.0090.01216.88
7.2.160.0070.01016.82
7.2.150.0180.00218.46
7.2.140.0110.00818.37
7.2.130.0150.00018.55
7.2.120.0070.01018.27
7.2.110.0080.01017.63
7.2.100.0070.01118.48
7.2.90.0100.00318.51
7.2.80.0080.00818.53
7.2.70.0070.01318.56
7.2.60.0090.00617.74
7.2.50.0130.00718.36
7.2.40.0090.00918.50
7.2.30.0130.00318.48
7.2.20.0140.00318.35
7.2.10.0040.01218.56
7.2.00.0090.00618.55
7.1.330.0110.00617.31
7.1.320.0030.01017.42
7.1.310.0030.01017.61
7.1.300.0030.01217.71
7.1.290.0100.00717.47
7.1.280.0070.01017.39
7.1.270.0030.01017.46
7.1.260.0080.00817.39
7.1.250.0110.00717.42
7.1.240.0120.00417.47
7.1.230.0120.00317.41
7.1.220.0030.01217.42
7.1.210.0120.00617.26
7.1.200.0050.01016.68
7.1.190.0030.01117.43
7.1.180.0030.01317.38
7.1.170.0060.00917.36
7.1.160.0110.00417.25
7.1.150.0130.00317.39
7.1.140.0090.00917.55
7.1.130.0030.01417.50
7.1.120.0140.00317.38
7.1.110.0240.00416.93
7.1.100.0140.01516.94
7.1.90.0120.01117.06
7.1.80.0180.01216.92
7.1.70.0180.00716.56
7.1.60.0210.01025.29
7.1.50.0200.01025.01
7.1.40.0240.01624.97
7.1.30.0300.00925.03
7.1.20.0290.00724.91
7.1.10.0200.00716.23
7.1.00.0520.01216.30
7.0.330.0100.01016.91
7.0.320.0100.00717.19
7.0.310.0060.00917.26
7.0.300.0060.00617.13
7.0.290.0080.00717.12
7.0.280.0040.01416.98
7.0.270.0030.01216.84
7.0.260.0090.00617.22
7.0.250.0350.01716.59
7.0.240.0250.00516.68
7.0.230.0190.00716.81
7.0.220.0200.01016.70
7.0.210.0180.00916.27
7.0.200.0120.00716.28
7.0.190.0170.01116.40
7.0.180.0200.00815.94
7.0.170.0140.00815.73
7.0.160.0110.01315.99
7.0.150.0180.00616.01
7.0.140.0140.00915.93
7.0.130.0130.00816.02
7.0.120.0220.00315.98
7.0.110.0160.00815.93
7.0.100.0170.00915.88
7.0.90.0170.00715.98
7.0.80.0150.00815.94
7.0.70.0130.01315.94
7.0.60.0130.01115.88
7.0.50.0140.01115.88
7.0.40.0080.01014.91
7.0.30.0110.01114.88
7.0.20.0170.01014.78
7.0.10.0200.00514.94
7.0.00.0140.00914.87
5.6.400.0040.01215.96
5.6.390.0040.01216.11
5.6.380.0110.00416.08
5.6.370.0050.00916.05
5.6.360.0040.01116.25
5.6.350.0060.00915.68
5.6.340.0070.00716.16
5.6.330.0160.00515.89
5.6.320.0090.00616.10
5.6.310.0110.00615.70
5.6.300.0060.01216.23
5.6.290.0090.00615.67
5.6.280.0060.00916.26
5.6.270.0110.00716.07
5.6.260.0030.01315.79
5.6.250.0070.00715.66
5.6.240.0070.00716.05
5.6.230.0030.01015.95
5.6.220.0070.00315.86
5.6.210.0140.00316.19
5.6.200.0080.00415.93
5.6.190.0050.01116.07
5.6.180.0120.00615.80
5.6.170.0080.00815.71
5.6.160.0130.00616.06
5.6.150.0110.00415.77
5.6.140.0060.01215.91
5.6.130.0030.01215.83
5.6.120.0070.01015.93
5.6.110.0000.01815.99
5.6.100.0070.00715.91
5.6.90.0000.01715.85
5.6.80.0070.01415.80
5.6.70.0060.00915.72
5.6.60.0090.00615.71
5.6.50.0120.00315.60
5.6.40.0090.00915.68
5.6.30.0040.01115.89
5.6.20.0040.01615.82
5.6.10.0080.00815.75
5.6.00.0100.01015.89

preferences:
48.42 ms | 401 KiB | 5 Q