3v4l.org

run code in 300+ PHP versions simultaneously
<?php $searchArray = array('settings all','print', 'sum', 'industry'); // total 50K words function sanitize($string,$searchArray) { $repl = array_map("dashReplace", $searchArray); $pattern = array_map("insertWordBoundaries", $searchArray); $string = preg_replace($pattern,$repl,$string); return $string; } function dashReplace($str) { return "<span class='txtOlg'>" . $str . "</span>"; } function insertWordBoundaries($str){ return "/\b". preg_quote($str,"/") ."\b/"; } $text = 'Lorem Ipsum is simply dummy text of the printing and typesettings all industry.'; echo sanitize($text,$searchArray);

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.130.0120.00318.59
8.3.120.0090.00018.84
8.3.110.0100.00620.94
8.3.100.0100.00016.67
8.3.90.0040.00426.77
8.3.80.0110.00419.36
8.3.70.0090.00616.63
8.3.60.0070.01018.68
8.3.50.0070.00524.50
8.3.40.0110.00418.98
8.3.30.0120.00318.84
8.3.20.0040.00420.74
8.3.10.0050.00320.09
8.3.00.0080.00020.61
8.2.250.0030.00616.70
8.2.240.0090.00017.21
8.2.230.0060.00322.58
8.2.220.0040.00424.06
8.2.210.0060.00626.77
8.2.200.0060.00618.88
8.2.190.0110.01116.58
8.2.180.0120.00418.78
8.2.170.0000.01519.08
8.2.160.0110.00822.96
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0030.00626.16
8.2.110.0090.00020.38
8.2.100.0120.00017.84
8.2.90.0080.00017.97
8.2.80.0000.00817.97
8.2.70.0040.00417.93
8.2.60.0040.00418.22
8.2.50.0030.00518.10
8.2.40.0040.00419.34
8.2.30.0050.00219.29
8.2.20.0000.00718.16
8.2.10.0030.00519.16
8.2.00.0000.00819.28
8.1.300.0100.01016.63
8.1.290.0000.00930.84
8.1.280.0120.00625.92
8.1.270.0030.00620.77
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00322.46
8.1.230.0110.00020.95
8.1.220.0000.00817.79
8.1.210.0050.00318.84
8.1.200.0060.00317.48
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0030.00518.83
8.1.160.0000.00719.10
8.1.150.0000.00718.84
8.1.140.0000.00720.70
8.1.130.0000.00720.24
8.1.120.0000.00817.59
8.1.110.0040.00417.54
8.1.100.0040.00417.51
8.1.90.0000.00717.64
8.1.80.0040.00417.55
8.1.70.0030.00517.60
8.1.60.0000.00817.68
8.1.50.0000.00817.66
8.1.40.0040.00417.60
8.1.30.0000.00817.86
8.1.20.0030.00517.83
8.1.10.0050.00317.68
8.1.00.0000.00717.68
8.0.300.0070.00019.95
8.0.290.0050.00616.75
8.0.280.0060.00318.48
8.0.270.0030.00517.26
8.0.260.0030.00320.11
8.0.250.0030.00317.14
8.0.240.0000.00816.99
8.0.230.0040.00417.16
8.0.220.0000.00716.95
8.0.210.0030.00316.95
8.0.200.0030.00317.08
8.0.190.0030.00517.11
8.0.180.0070.00017.09
8.0.170.0040.00417.03
8.0.160.0000.00717.07
8.0.150.0030.00517.10
8.0.140.0080.00017.00
8.0.130.0060.00013.54
8.0.120.0040.00417.02
8.0.110.0000.00716.89
8.0.100.0000.00817.09
8.0.90.0060.00317.12
8.0.80.0110.01117.00
8.0.70.0040.00416.86
8.0.60.0070.00017.04
8.0.50.0040.00416.97
8.0.30.0140.00317.38
8.0.20.0100.00716.97
8.0.10.0040.00416.98
8.0.00.0070.01416.98
7.4.330.0050.00015.55
7.4.320.0000.00616.80
7.4.300.0030.00316.83
7.4.290.0040.00416.67
7.4.280.0060.00316.73
7.4.270.0090.00316.74
7.4.260.0060.00316.81
7.4.250.0030.00516.70
7.4.240.0060.00216.80
7.4.230.0070.00016.94
7.4.220.0020.00516.91
7.4.210.0110.00316.75
7.4.200.0000.00716.73
7.4.140.0140.00317.86
7.4.130.0090.00916.71
7.4.120.0100.00716.59
7.4.110.0120.00616.61
7.4.100.0120.01016.70
7.4.90.0000.01816.45
7.4.80.0120.00419.39
7.4.70.0100.00716.54
7.4.60.0120.00616.68
7.4.50.0120.00616.64
7.4.40.0060.01016.73
7.4.10.0090.00615.22
7.4.00.0080.00815.07
7.3.330.0000.00816.47
7.3.320.0000.00513.33
7.3.310.0000.00616.58
7.3.300.0040.00416.52
7.3.290.0080.00816.47
7.3.280.0030.01716.42
7.3.260.0140.00616.63
7.3.240.0080.01016.64
7.3.230.0100.01316.66
7.3.210.0140.00316.60
7.3.200.0080.00816.52
7.3.190.0030.02316.70
7.3.180.0060.01016.59
7.3.170.0110.01116.70
7.3.160.0040.01216.55
7.3.130.0130.00314.86
7.3.120.0090.00715.16
7.3.110.0050.01114.87
7.3.100.0050.01114.74
7.3.90.0050.00915.07
7.3.80.0050.00714.91
7.3.70.0060.00914.88
7.3.60.0030.01114.96
7.3.50.0040.01015.00
7.3.40.0120.00415.07
7.3.30.0100.00514.85
7.3.20.0060.01115.74
7.3.10.0110.00615.86
7.3.00.0100.00615.96
7.2.330.0140.00316.83
7.2.320.0110.00716.79
7.2.310.0110.00816.83
7.2.300.0100.01516.83
7.2.290.0060.01116.93
7.2.260.0030.01415.08
7.2.250.0070.01115.02
7.2.240.0050.01014.97
7.2.230.0120.00115.40
7.2.220.0050.01215.26
7.2.210.0080.00715.24
7.2.200.0040.01115.17
7.2.190.0040.00815.20
7.2.180.0060.00815.11
7.2.170.0060.00815.25
7.2.160.0050.01115.21
7.2.150.0070.01016.21
7.2.140.0090.00816.17
7.2.130.0070.01016.20
7.2.120.0120.00316.06
7.2.110.0060.00816.11
7.2.100.0050.01216.17
7.2.90.0050.00916.09
7.2.80.0050.01116.19
7.2.70.0060.01016.08
7.2.60.0050.01116.07
7.2.50.0060.01016.11
7.2.40.0070.01016.25
7.2.30.0100.00616.16
7.2.20.0120.00416.24
7.2.10.0080.00816.11
7.2.00.0070.00916.05
7.1.330.0100.00415.16
7.1.320.0070.01014.98
7.1.310.0110.00815.06
7.1.300.0100.00115.02
7.1.290.0050.00614.99
7.1.280.0030.00814.97
7.1.270.0280.00814.91
7.1.260.0080.00514.97
7.1.250.0060.00515.00
7.1.240.0030.01315.93
7.1.230.0060.00615.86
7.1.220.0100.00715.92
7.1.210.0070.01016.11
7.1.200.0040.01116.04
7.1.190.0110.00415.75
7.1.180.0040.00415.50
7.1.170.0070.01015.91
7.1.160.0100.00316.00
7.1.150.0030.01015.57
7.1.140.0000.00915.88
7.1.130.0000.01115.98
7.1.120.0060.00615.94
7.1.110.0040.01115.88
7.1.100.0040.00415.82
7.1.90.0060.00315.90
7.1.80.0060.00916.03
7.1.70.0060.00315.71
7.1.60.0030.00616.13
7.1.50.0060.00615.83
7.1.40.0030.00915.71
7.1.30.0080.00015.95
7.1.20.0000.00816.05
7.1.10.0070.00415.94
7.1.00.0000.01516.06

preferences:
66.69 ms | 403 KiB | 5 Q