3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "<p>Just a test: getName testName</p>"; $keywords = [ 0=>['id'=>1,'slug'=>'getName','url'=>'https://www.getname.com'], 1=>['id'=>2,'slug'=>'testName','url'=>'https://www.testname.com'], 2=>['id'=>3,'slug'=>'ign','url'=>'https://www.ign.com'] ]; $newKeywords = []; foreach ($keywords as $keyword) $newKeywords[$keyword['slug']] = $keyword['url']; $newStr = preg_replace_callback("/(\w+)/", function($m) use($newKeywords){ return isset($newKeywords[$m[0]]) ? "<a href='{$newKeywords[$m[0]]}'>{$m[0]}</a>" : $m[0]; }, $str); echo $newStr;

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.0030.00518.58
8.3.120.0050.00520.56
8.3.110.0030.00516.80
8.3.100.0050.00516.89
8.3.90.0080.00018.61
8.3.80.0040.00416.63
8.3.70.0090.00616.75
8.3.60.0140.00716.75
8.3.50.0110.00618.21
8.3.40.0150.00019.05
8.3.30.0060.00918.98
8.3.20.0030.00618.93
8.3.10.0080.00023.65
8.3.00.0040.00420.64
8.2.250.0040.00416.97
8.2.240.0040.00417.08
8.2.230.0130.00320.94
8.2.220.0000.00824.06
8.2.210.0060.01226.77
8.2.200.0060.00316.63
8.2.190.0070.01416.72
8.2.180.0040.01118.79
8.2.170.0140.00022.96
8.2.160.0070.00721.21
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0060.01220.02
8.2.120.0080.00026.35
8.2.110.0160.00620.22
8.2.100.0100.00318.16
8.2.90.0060.00318.09
8.2.80.0050.00318.16
8.2.70.0000.00818.16
8.2.60.0040.00418.22
8.2.50.0000.01118.10
8.2.40.0040.00419.30
8.2.30.0040.00419.46
8.2.20.0050.00318.05
8.2.10.0000.00718.36
8.2.00.0040.00417.89
8.1.300.0090.00018.57
8.1.290.0060.00330.84
8.1.280.0040.01125.92
8.1.270.0080.00019.00
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0080.00020.99
8.1.230.0000.01120.88
8.1.220.0040.00417.74
8.1.210.0050.00318.97
8.1.200.0030.00617.60
8.1.190.0030.00617.60
8.1.180.0030.00618.10
8.1.170.0000.00818.79
8.1.160.0040.00418.96
8.1.150.0020.00518.85
8.1.140.0030.00322.24
8.1.130.0000.00720.24
8.1.120.0050.00317.69
8.1.110.0000.00717.61
8.1.100.0000.00717.61
8.1.90.0070.00017.52
8.1.80.0040.00417.59
8.1.70.0000.00717.64
8.1.60.0000.00917.80
8.1.50.0020.00517.63
8.1.40.0080.00017.71
8.1.30.0050.00317.84
8.1.20.0040.00417.73
8.1.10.0000.00817.83
8.1.00.0000.00817.70
8.0.300.0040.00419.90
8.0.290.0040.00416.88
8.0.280.0000.00818.48
8.0.270.0050.00217.21
8.0.260.0070.00018.48
8.0.250.0030.00317.15
8.0.240.0000.00617.12
8.0.230.0030.00717.07
8.0.220.0000.00717.04
8.0.210.0030.00316.98
8.0.200.0000.00917.00
8.0.190.0000.00716.98
8.0.180.0030.00517.04
8.0.170.0030.00516.96
8.0.160.0040.00417.07
8.0.150.0050.00216.97
8.0.140.0040.00417.01
8.0.130.0000.00613.52
8.0.120.0040.00417.02
8.0.110.0000.00717.08
8.0.100.0020.00516.83
8.0.90.0080.00016.89
8.0.80.0070.01117.03
8.0.70.0040.00417.05
8.0.60.0030.00517.16
8.0.50.0020.00517.03
8.0.30.0090.00917.18
8.0.20.0130.00617.40
8.0.10.0070.00017.06
8.0.00.0050.01316.86
7.4.330.0050.00015.55
7.4.320.0000.00616.76
7.4.300.0030.00316.80
7.4.290.0030.00616.71
7.4.280.0080.00016.57
7.4.270.0020.00516.69
7.4.260.0000.00816.84
7.4.250.0030.00316.71
7.4.240.0000.00716.84
7.4.230.0000.00716.81
7.4.220.0040.00416.57
7.4.210.0080.00916.82
7.4.200.0070.00016.86
7.4.160.0100.00816.71
7.4.140.0120.00717.86
7.4.130.0180.00316.63
7.4.120.0090.01016.75
7.4.110.0070.01816.86
7.4.100.0140.00316.81
7.4.90.0110.01216.61
7.4.80.0140.00319.39
7.4.70.0070.01416.90
7.4.60.0160.00016.80
7.4.50.0060.00616.69
7.4.40.0130.00616.66
7.4.00.0130.00314.88
7.3.330.0000.00513.38
7.3.320.0000.00513.33
7.3.310.0000.00916.61
7.3.300.0000.00716.37
7.3.290.0070.00016.48
7.3.280.0030.01216.52
7.3.260.0120.00916.72
7.3.240.0080.01016.73
7.3.230.0120.00616.72
7.3.210.0040.01416.86
7.3.200.0060.01516.50
7.3.190.0150.00316.59
7.3.180.0110.00716.56
7.3.170.0030.01516.75
7.3.160.0100.00716.45
7.3.10.0100.00316.86
7.3.00.0000.00916.69
7.2.330.0120.00916.85
7.2.320.0170.00516.86
7.2.310.0100.00716.70
7.2.300.0070.01016.87
7.2.290.0070.01016.83
7.2.130.0040.00716.95
7.2.120.0000.01017.25
7.2.110.0140.00416.08
7.2.100.0140.00816.04
7.2.90.0130.00616.01
7.2.80.0080.01315.99
7.2.70.0140.00815.99
7.2.60.0150.00716.29
7.2.50.0780.00216.15
7.2.40.0110.01116.13
7.2.30.0160.00716.16
7.2.20.0140.01116.19
7.2.10.0090.01016.21
7.2.00.0100.00816.21
7.1.250.0070.00616.04
7.1.230.0240.00713.86
7.1.220.0190.01013.91
7.1.210.0130.00514.04
7.1.200.0200.01113.85
7.1.190.0230.00413.66
7.1.180.0280.00414.08
7.1.170.0200.00914.13
7.1.160.0240.01014.03
7.1.150.0220.00914.18
7.1.140.0210.01014.03
7.1.130.0220.00413.87
7.1.120.0280.00314.17
7.1.110.0140.01314.20
7.1.100.0090.00913.89
7.1.90.0250.00713.86
7.1.80.0230.00814.08
7.1.70.0250.00913.99
7.1.60.0400.00932.00
7.1.50.0380.00631.84
7.1.40.0440.00732.23
7.1.30.0400.00432.07
7.1.20.0430.00032.19
7.1.10.0240.00614.14
7.1.00.0270.00314.24
5.6.380.0100.00314.29

preferences:
48.34 ms | 403 KiB | 5 Q