3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text="hello world"; $searches= array(); $searches = array( array("text" => "hello", "url" => "hello-URL"), array("text" => "world", "url" => "world-URL"), array("text" => "hello world", "url" => "helloworld-URL") ); usort($searches, function($a, $b) { return strlen($b['text']) - strlen($a['text']); }); $pat = '~(?<!\w)(?:' . implode("|", array_map(function($x) { return preg_quote($x['text'], '~'); }, $searches) ) . ')(?!\w)~i'; // echo "$pat\n"; // => ~(?<!\w)(?:hello world|hello|world)(?!\w)~i $keys = array(); $vals = array(); foreach($searches as $search) { $keys[] = $search['text']; $vals[] = $search['url']; } $tmparr = array_combine($keys, $vals); $text = preg_replace_callback($pat, function($m) use ($tmparr) { return "<a href='" . $tmparr[$m[0]] . "'>" . $m[0] . "</a>"; }, $text); echo $text;

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.5.30.0090.00919.45
8.5.20.0110.00820.17
8.5.10.0120.00916.75
8.5.00.0180.00520.38
8.4.180.0100.01219.94
8.4.170.0090.01320.73
8.4.160.0110.01121.58
8.4.150.0070.00617.07
8.4.140.0150.00618.01
8.4.130.0160.00518.03
8.4.120.0110.00624.21
8.4.110.0140.00722.09
8.4.100.0060.00318.20
8.4.90.0160.00518.64
8.4.80.0100.00519.87
8.4.70.0080.00817.91
8.4.60.0050.00618.88
8.4.50.0100.01117.95
8.4.40.0160.00317.93
8.4.30.0130.00717.79
8.4.20.0120.00917.91
8.4.10.0050.00519.75
8.3.300.0100.01118.63
8.3.290.0100.01220.95
8.3.280.0130.00718.71
8.3.270.0100.00916.91
8.3.260.0090.01016.87
8.3.250.0100.00919.29
8.3.240.0090.00917.26
8.3.230.0110.00717.11
8.3.220.0120.00717.27
8.3.210.0120.00716.67
8.3.200.0050.00317.04
8.3.190.0110.00716.90
8.3.180.0040.00416.91
8.3.170.0110.00719.04
8.3.160.0050.00316.91
8.3.150.0070.01420.98
8.3.140.0100.01016.91
8.3.130.0040.01118.52
8.3.120.0050.00519.09
8.3.110.0030.00620.94
8.3.100.0110.00724.06
8.3.90.0040.00426.77
8.3.80.0080.00417.13
8.3.70.0120.00618.38
8.3.60.0150.00017.13
8.3.50.0130.01016.71
8.3.40.0150.00019.09
8.3.30.0070.00718.96
8.3.20.0070.00021.89
8.3.10.0000.00721.76
8.3.00.0040.00419.54
8.2.300.0120.00822.18
8.2.290.0160.00320.64
8.2.280.0100.01018.82
8.2.270.0090.00917.14
8.2.260.0030.00618.67
8.2.250.0090.00917.00
8.2.240.0120.00617.09
8.2.230.0080.00022.58
8.2.220.0030.00637.54
8.2.210.0040.01426.77
8.2.200.0040.00816.88
8.2.190.0040.01116.58
8.2.180.0190.00616.73
8.2.170.0060.01222.96
8.2.160.0070.00719.46
8.2.150.0040.00425.66
8.2.140.0100.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00819.61
8.2.110.0100.00020.34
8.2.100.0030.00917.96
8.2.90.0030.00617.88
8.2.80.0080.00017.97
8.2.70.0030.00618.04
8.2.60.0040.00818.22
8.2.50.0000.00818.10
8.2.40.0030.00622.43
8.2.30.0040.00419.43
8.2.20.0000.00818.30
8.2.10.0050.00218.15
8.2.00.0080.00018.31
8.1.340.0140.00717.75
8.1.330.0140.00521.95
8.1.320.0120.00816.74
8.1.310.0070.01118.66
8.1.300.0000.00820.09
8.1.290.0090.00030.84
8.1.280.0070.00725.92
8.1.270.0050.00324.66
8.1.260.0040.01226.35
8.1.250.0080.00028.09
8.1.240.0030.00624.00
8.1.230.0090.00320.79
8.1.220.0080.00017.80
8.1.210.0000.00819.01
8.1.200.0090.00017.61
8.1.190.0000.00817.60
8.1.180.0030.00618.10
8.1.170.0000.00818.88
8.1.160.0040.00419.02
8.1.150.0040.00421.99
8.1.140.0070.00019.65
8.1.130.0040.00418.95
8.1.120.0000.00717.57
8.1.110.0040.00417.56
8.1.100.0000.00717.71
8.1.90.0000.00717.62
8.1.80.0090.00017.64
8.1.70.0030.00317.66
8.1.60.0080.00017.77
8.1.50.0040.00417.73
8.1.40.0030.00517.62
8.1.30.0000.00917.88
8.1.20.0040.00417.75
8.1.10.0000.00817.69
8.1.00.0040.00417.77
8.0.300.0040.00419.84
8.0.290.0030.00617.00
8.0.280.0080.00018.48
8.0.270.0040.00417.21
8.0.260.0000.00718.80
8.0.250.0000.00717.18
8.0.240.0080.00017.19
8.0.230.0000.00717.09
8.0.220.0030.00317.03
8.0.210.0030.00317.01
8.0.200.0030.00317.13
8.0.190.0090.00017.03
8.0.180.0070.00017.06
8.0.170.0000.00916.99
8.0.160.0040.00417.08
8.0.150.0020.00516.91
8.0.140.0110.00017.08
8.0.130.0030.00313.45
8.0.120.0000.00916.98
8.0.110.0080.00017.13
8.0.100.0070.00016.95
8.0.90.0080.00016.89
8.0.80.0100.01017.02
8.0.70.0070.00017.10
8.0.60.0040.00417.05
8.0.50.0000.00917.04
8.0.30.0070.01117.31
8.0.20.0120.00717.44
8.0.10.0040.00417.18
8.0.00.0110.00716.98
7.4.330.0040.00415.55
7.4.320.0030.00316.75
7.4.300.0060.00016.80
7.4.290.0100.00016.73
7.4.280.0040.00416.70
7.4.270.0040.00416.74
7.4.260.0040.00416.76
7.4.250.0040.00416.68
7.4.240.0080.00016.64
7.4.230.0000.00716.86
7.4.220.0130.00616.79
7.4.210.0060.01316.79
7.4.200.0050.00316.90
7.4.160.0080.01016.67
7.4.150.0070.01017.40
7.4.140.0080.01017.86
7.4.130.0100.00716.65
7.4.120.0110.00916.70
7.4.110.0090.00916.53
7.4.100.0060.01916.95
7.4.90.0110.00716.59
7.4.80.0110.00619.39
7.4.70.0110.00416.70
7.4.60.0170.00316.54
7.4.50.0080.00416.72
7.4.40.0060.01016.41
7.4.30.0090.00916.80
7.4.00.0000.01015.30
7.3.330.0000.00613.38
7.3.320.0060.00013.38
7.3.310.0000.00716.45
7.3.300.0000.00716.47
7.3.290.0100.00316.44
7.3.280.0070.01016.45
7.3.270.0180.00017.40
7.3.260.0100.00816.81
7.3.250.0100.01116.74
7.3.240.0130.00516.46
7.3.230.0030.01316.49
7.3.210.0030.01516.76
7.3.200.0100.01016.81
7.3.190.0090.01516.75
7.3.180.0130.00316.43
7.3.170.0060.00916.51
7.3.160.0130.00316.48
7.2.330.0030.01517.02
7.2.320.0070.01116.85
7.2.310.0060.01216.92
7.2.300.0100.00716.95
7.2.290.0100.00716.90
7.2.60.0070.00717.22
7.2.50.0100.00617.19
7.1.200.0030.00616.16
7.1.70.0050.00317.44
7.1.60.0930.01033.29
7.1.50.0530.01333.13
7.1.40.0730.01732.97
7.1.30.0670.01733.20
7.1.20.0900.02033.10
7.1.10.0770.01014.98
7.1.00.0870.01715.07
7.0.200.0400.01715.02
7.0.190.0430.00715.14
7.0.180.0670.01714.71
7.0.170.0970.01014.60
7.0.160.0830.01714.76
7.0.150.0700.01714.84
7.0.140.0730.01314.76
7.0.130.0800.01715.04
7.0.120.0800.01014.96
7.0.110.0400.01014.89
7.0.100.0630.01714.82
7.0.90.0430.01314.71
7.0.80.0430.01314.68
7.0.70.0570.00714.75
7.0.60.0530.01714.37
7.0.50.0500.01014.89
7.0.40.0600.01314.94
7.0.30.0500.00315.12
7.0.20.1100.01314.61
7.0.10.0570.01015.00
7.0.00.0430.01014.77

preferences:
61.76 ms | 1460 KiB | 5 Q