3v4l.org

run code in 300+ PHP versions simultaneously
<?php function badwords_full($string, &$bad_references) { static $bad_counter; static $bad_list; static $bad_list_q; if(!isset($bad_counter)) { $bad_counter = 0; $bad_list = badwords_list(); $bad_list_q = array_map('preg_quote', $bad_list); } return preg_replace_callback('~('.implode('|', $bad_list_q).')~', function($matches) use (&$bad_counter, &$bad_references) { $bad_counter++; $bad_references[$bad_counter] = $matches[0]; return mb_substr($matches[0], 0, 1).str_repeat('&squf;', strlen($matches[0]) - 1); }, $string); } function badwords_list() { # spanish $es = array( "gallina", "ñoño" ); # english $en = array( "chicken", "horse" ); # join all languages $list = array_merge($es, $en); usort($list, function($a,$b) { return strlen($b) < strlen($b); }); return $list; } echo badwords_full('Hola en español eres un ñoño!', $bad);

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.0040.00620.46
8.4.110.0100.01022.44
8.4.100.0150.00718.31
8.4.90.0100.00819.00
8.4.80.0130.00820.20
8.4.70.0110.00617.75
8.4.60.0090.01218.73
8.4.50.0140.00718.91
8.4.40.0140.00717.97
8.4.30.0120.00918.20
8.4.20.0100.01020.40
8.4.10.0000.01019.82
8.3.250.0110.00818.79
8.3.240.0110.00816.66
8.3.230.0140.00717.07
8.3.220.0080.00217.08
8.3.210.0040.00316.96
8.3.200.0020.00716.85
8.3.190.0100.00916.89
8.3.180.0030.00516.98
8.3.170.0140.00418.93
8.3.160.0030.01620.50
8.3.150.0130.00617.61
8.3.140.0060.00317.25
8.3.130.0060.00318.81
8.3.120.0050.00519.09
8.3.110.0030.00620.94
8.3.100.0060.00316.91
8.3.90.0040.00426.77
8.3.80.0120.00017.97
8.3.70.0120.00418.76
8.3.60.0110.01118.79
8.3.50.0100.01018.66
8.3.40.0120.00619.07
8.3.30.0130.00318.88
8.3.20.0090.00019.10
8.3.10.0100.00521.85
8.3.00.0110.00620.41
8.2.290.0100.00820.34
8.2.280.0100.00518.61
8.2.270.0090.00919.09
8.2.260.0120.00016.84
8.2.250.0060.00318.43
8.2.240.0030.00619.16
8.2.230.0030.00622.58
8.2.220.0070.01424.06
8.2.210.0040.01126.77
8.2.200.0030.00618.79
8.2.190.0060.01218.64
8.2.180.0070.01418.64
8.2.170.0140.00722.96
8.2.160.0110.00422.28
8.2.150.0000.00824.18
8.2.140.0050.00822.59
8.2.130.0080.00523.34
8.2.120.0090.00619.36
8.2.110.0120.00318.98
8.2.100.0070.00818.53
8.2.90.0030.01218.45
8.2.80.0080.00718.43
8.2.70.0170.00518.38
8.2.60.0120.00218.62
8.2.50.0080.00518.55
8.2.40.0070.00719.96
8.2.30.0050.00919.83
8.2.20.0050.00718.46
8.2.10.0030.01018.45
8.2.00.0080.00418.58
8.1.330.0110.00821.78
8.1.320.0100.01016.68
8.1.310.0100.01018.45
8.1.300.0090.00019.84
8.1.290.0090.00030.84
8.1.280.0040.01125.92
8.1.270.0080.00321.16
8.1.260.0100.00124.17
8.1.250.0060.00525.08
8.1.240.0120.00218.92
8.1.230.0090.00718.30
8.1.220.0070.00418.37
8.1.210.0070.00518.70
8.1.200.0110.00118.13
8.1.190.0100.00717.96
8.1.180.0070.00318.37
8.1.170.0050.00718.70
8.1.160.0010.00718.75
8.1.150.0070.00418.86
8.1.140.0060.00618.75
8.1.130.0080.00420.43
8.1.120.0040.00518.09
8.1.110.0050.00418.12
8.1.100.0080.00318.13
8.1.90.0040.00618.10
8.1.80.0070.00318.13
8.1.70.0030.00618.14
8.1.60.0050.00418.28
8.1.50.0090.00018.17
8.1.40.0030.00618.21
8.1.30.0010.00718.40
8.1.20.0000.00818.44
8.1.10.0000.00818.31
8.1.00.0040.00418.24
8.0.300.0020.00618.40
8.0.290.0130.00017.52
8.0.280.0100.00218.16
8.0.270.0030.00417.69
8.0.260.0070.00418.15
8.0.250.0090.00017.74
8.0.240.0060.00617.64
8.0.230.0040.00617.67
8.0.220.0070.00317.59
8.0.210.0050.00517.58
8.0.200.0030.00517.70
8.0.190.0010.00617.69
8.0.180.0030.00517.63
8.0.170.0070.00517.60
8.0.160.0010.00717.68
8.0.150.0040.00717.56
8.0.140.0080.00417.55
8.0.130.0070.00315.85
8.0.120.0060.00517.61
8.0.110.0020.00517.58
8.0.100.0040.00617.51
8.0.90.0120.00517.58
8.0.80.0110.00517.48
8.0.70.0050.00317.74
8.0.60.0060.00517.63
8.0.50.0100.00117.59
8.0.30.0090.00817.67
8.0.20.0090.00817.50
8.0.10.0110.00517.71
8.0.00.0090.00817.83
7.4.330.0090.00414.63
7.4.320.0130.00617.25
7.4.300.0100.00117.19
7.4.290.0070.00517.14
7.4.280.0090.00417.21
7.4.270.0100.00217.33
7.4.260.0150.00717.09
7.4.250.0130.00017.20
7.4.240.0120.00617.14
7.4.230.0100.00817.22
7.4.220.0100.00317.23
7.4.210.0150.01017.07
7.4.200.0110.00117.20
7.4.190.0250.00917.75
7.4.180.0270.00717.87
7.4.160.0110.00616.84
7.4.150.0200.00617.16
7.4.140.0110.00717.72
7.4.130.0170.00417.08
7.4.120.0130.00916.84
7.4.110.0150.00617.09
7.4.100.0120.00717.07
7.4.90.0100.00717.04
7.4.80.0120.00517.97
7.4.70.0110.00617.09
7.4.60.0120.00716.97
7.4.50.0130.00416.95
7.4.40.0110.00617.01
7.4.30.0180.00517.12
7.4.20.0190.00317.20
7.4.10.0140.00317.34
7.4.00.0130.00616.60
7.3.330.0090.00515.39
7.3.320.0140.00215.36
7.3.310.0150.00216.99
7.3.300.0100.00317.07
7.3.290.0120.00217.04
7.3.280.0080.00717.06
7.3.270.0150.01217.15
7.3.260.0100.00716.89
7.3.250.0160.00717.14
7.3.240.0130.00516.85
7.3.230.0160.00717.02
7.3.220.0190.00617.04
7.3.210.0130.00716.79
7.3.200.0140.00516.92
7.3.190.0120.01016.97
7.3.180.0120.00616.93
7.3.170.0120.01017.03
7.3.160.0140.00716.87
7.3.150.0110.00817.08
7.3.140.0150.00316.82
7.3.130.0090.00817.07
7.3.120.0110.00617.10
7.3.110.0140.00217.06
7.3.100.0130.00517.01
7.3.90.0110.00617.18
7.3.80.0080.00917.19
7.3.70.0110.00717.01
7.3.60.0080.00817.13
7.3.50.0110.00717.11
7.3.40.0210.00817.20
7.3.30.0140.00417.11
7.3.20.0170.00717.22
7.3.10.0100.00817.18
7.3.00.0170.01017.03
7.2.340.0210.00717.19
7.2.330.0210.00517.05
7.2.320.0220.00817.12
7.2.310.0220.00717.09
7.2.300.0230.00517.08
7.2.290.0210.00817.19
7.2.280.0250.00917.19
7.2.270.0260.00917.21
7.2.260.0260.00617.13
7.2.250.0200.00717.29
7.2.240.0180.00817.33
7.2.230.0210.00417.42
7.2.220.0200.00817.23
7.2.210.0220.00817.40
7.2.200.0260.00917.39
7.2.190.0270.01017.41
7.2.180.0280.00317.24
7.2.170.0190.00917.29
7.2.160.0210.00317.25
7.2.150.0200.00617.43
7.2.140.0220.00317.24
7.2.130.0150.00817.38
7.2.120.0160.00817.29
7.2.110.0130.01317.43
7.2.100.0450.00516.52
7.2.90.0420.00916.61
7.2.80.0390.00716.67
7.2.70.0430.00416.63
7.2.60.0390.00616.59
7.2.50.0390.00916.64
7.2.40.0340.01316.62
7.2.30.0470.00716.69
7.2.20.0410.00416.74
7.2.10.0290.00616.65
7.2.00.0510.00316.45
7.1.330.0240.00616.12
7.1.320.0160.00716.38
7.1.310.0510.00517.08
7.1.300.0240.00917.10
7.1.290.0170.00717.15
7.1.280.0400.00317.10
7.1.270.0170.00717.67
7.1.260.0180.00817.09
7.1.250.0200.00317.03
7.1.240.0290.00516.94
7.1.230.0120.01417.03
7.1.220.0330.00916.03
7.1.210.0380.00916.01
7.1.200.0520.00616.16
7.1.190.0450.00315.93
7.1.180.0480.01016.11
7.1.170.0680.00516.07
7.1.160.0460.00616.13
7.1.150.0500.00616.06
7.1.140.0420.00816.19
7.1.130.0350.01016.13
7.1.120.0450.00616.01
7.1.110.0320.00616.18
7.1.100.0360.00816.07
7.1.90.0420.00416.16
7.1.80.0720.00416.06
7.1.70.0490.00816.13
7.1.60.0410.00922.05
7.1.50.0480.00922.17
7.1.40.0430.00722.22
7.1.30.0460.00722.19
7.1.20.0560.00522.24
7.1.10.0370.00816.25
7.1.00.0310.00416.07
7.0.330.0220.00416.75
7.0.320.0130.00716.83
7.0.310.0200.00616.67
7.0.300.0200.00516.72
7.0.290.0170.00716.90
7.0.280.0170.00716.79
7.0.270.0150.00716.75
7.0.260.0260.00316.81
7.0.250.0240.00516.84
7.0.240.0140.00816.92
7.0.230.0200.01016.88
7.0.220.0170.01516.80
7.0.210.0200.01216.90
7.0.200.0160.01216.87
7.0.190.0230.00816.88
7.0.180.0240.00516.85
7.0.170.0170.00916.72
7.0.160.0790.00716.75
7.0.150.0180.00916.88
7.0.140.0160.01016.85
7.0.130.0190.01316.84
7.0.120.0180.01116.87
7.0.110.0230.00716.72
7.0.100.0760.00316.79
7.0.90.0150.00716.76
7.0.80.0190.00316.67
7.0.70.0150.00916.88
7.0.60.0170.00716.79
7.0.50.0120.01316.81
7.0.40.0160.00916.85
7.0.30.0120.00716.77
7.0.20.0170.00516.84
7.0.10.0150.00816.58
7.0.00.0160.00516.69
5.6.400.0110.00916.78
5.6.390.0110.01016.66
5.6.380.0110.00715.91
5.6.370.0130.00516.61
5.6.360.0150.00716.48
5.6.350.0150.00516.65
5.6.340.0090.01016.66
5.6.330.0130.00716.61
5.6.320.0100.00916.58
5.6.310.0090.00916.69
5.6.300.0110.00816.56
5.6.290.0140.00616.56
5.6.280.0160.00416.69
5.6.270.0100.01016.61
5.6.260.0080.01016.48
5.6.250.0100.00816.63
5.6.240.0130.00516.63
5.6.230.0100.00816.77
5.6.220.0140.00516.58
5.6.210.0100.00916.71
5.6.200.0130.01016.65
5.6.190.0160.00616.63
5.6.180.0110.00716.70
5.6.170.0180.00316.75
5.6.160.0160.00716.74
5.6.150.0180.00316.86
5.6.140.0180.00216.79
5.6.130.0140.00516.63
5.6.120.0130.00516.66
5.6.110.0100.01016.62
5.6.100.0120.00916.68
5.6.90.0140.00516.54
5.6.80.0070.01116.59
5.6.70.0110.00916.64
5.6.60.0140.00916.54
5.6.50.0140.01116.38
5.6.40.0130.00916.49
5.6.30.0090.00816.60
5.6.20.0140.00716.59
5.6.10.0170.00516.44
5.6.00.0140.00816.53

preferences:
91.72 ms | 403 KiB | 5 Q