3v4l.org

run code in 300+ PHP versions simultaneously
<?php function txt2link($text){ // force http: on www. $text = preg_replace( "www\.", "http://www.", $text ); // eliminate duplicates after force $text = preg_replace( "http://http://www\.", "http://www.", $text ); $text = preg_replace( "https://http://www\.", "https://www.", $text ); // The Regular Expression filter $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; // Check if there is a url in the text if(preg_match($reg_exUrl, $text, $url)) { // make the urls hyper links $text = preg_replace($reg_exUrl, '<a href="'.$url[0].'" rel="nofollow">'.$url[0].'</a>', $text); } // if no urls in the text just return the text return ($text); } $str = 'Hi bro! Look at my new website: www.example.com. I leard to build websites from http://another.example.net and from example.net.'; $newStr = txt2link($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.60.0070.01118.68
8.3.50.0080.00922.12
8.3.40.0070.01419.07
8.3.30.0070.00718.89
8.3.20.0050.00320.34
8.3.10.0060.00322.10
8.3.00.0040.00422.34
8.2.180.0130.00316.88
8.2.170.0150.00422.96
8.2.160.0110.00320.89
8.2.150.0080.00024.18
8.2.140.0120.00324.66
8.2.130.0050.00326.16
8.2.120.0080.00019.73
8.2.110.0100.00021.12
8.2.100.0090.00317.91
8.2.90.0070.00319.09
8.2.80.0040.00417.97
8.2.70.0030.00617.84
8.2.60.0060.00317.93
8.2.50.0050.00318.10
8.2.40.0050.00318.16
8.2.30.0040.00418.09
8.2.20.0000.00917.78
8.2.10.0000.00817.99
8.2.00.0090.00017.98
8.1.280.0030.01425.92
8.1.270.0050.00323.82
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00322.64
8.1.230.0090.00317.70
8.1.220.0000.00817.79
8.1.210.0060.00318.77
8.1.200.0030.00617.48
8.1.190.0060.00317.48
8.1.180.0080.00018.10
8.1.170.0030.00518.83
8.1.160.0000.00722.07
8.1.150.0000.00718.67
8.1.140.0090.00017.57
8.1.130.0070.00017.82
8.1.120.0040.00417.55
8.1.110.0000.00817.53
8.1.100.0070.00017.53
8.1.90.0000.00717.43
8.1.80.0000.00717.57
8.1.70.0030.00317.55
8.1.60.0060.00317.78
8.1.50.0040.00417.66
8.1.40.0050.00317.61
8.1.30.0030.00617.82
8.1.20.0040.00417.84
8.1.10.0040.00417.59
8.1.00.0080.00017.61
8.0.300.0040.00418.77
8.0.290.0060.00316.88
8.0.280.0050.00318.41
8.0.270.0000.00717.28
8.0.260.0030.00317.11
8.0.250.0000.00717.16
8.0.240.0000.00717.14
8.0.230.0040.00417.11
8.0.220.0000.00817.09
8.0.210.0000.00617.04
8.0.200.0040.00417.01
8.0.190.0000.00817.13
8.0.180.0040.00416.98
8.0.170.0040.00417.13
8.0.160.0100.00016.97
8.0.150.0070.00017.10
8.0.140.0000.00716.94
8.0.130.0000.00513.52
8.0.120.0000.00817.11
8.0.110.0000.00716.97
8.0.100.0070.00017.13
8.0.90.0040.00416.95
8.0.80.0000.01617.05
8.0.70.0020.00517.06
8.0.60.0000.00717.02
8.0.50.0040.00417.02
8.0.30.0100.01017.30
8.0.20.0030.01617.42
8.0.10.0040.00417.07
8.0.00.0100.00917.14
7.4.330.0030.00315.05
7.4.320.0000.00616.54
7.4.300.0070.00016.85
7.4.290.0070.00016.82
7.4.280.0000.00716.82
7.4.270.0040.00416.68
7.4.260.0040.00416.71
7.4.250.0030.00516.82
7.4.240.0040.00416.85
7.4.230.0070.00016.73
7.4.220.0100.01016.71
7.4.210.0060.00916.81
7.4.200.0030.00416.87
7.4.190.0000.00717.00
7.4.160.0130.00316.91
7.4.150.0070.01117.40
7.4.140.0070.01117.86
7.4.130.0080.00916.81
7.4.120.0080.01116.74
7.4.110.0070.01116.82
7.4.100.0140.00416.81
7.4.90.0130.00616.68
7.4.80.0150.00419.39
7.4.70.0030.01216.80
7.4.60.0090.00916.92
7.4.50.0040.00416.56
7.4.40.0100.00622.77
7.4.30.0130.00316.74
7.4.00.0060.00615.05
7.3.330.0000.00513.31
7.3.320.0020.00213.34
7.3.310.0050.00216.50
7.3.300.0040.00416.54
7.3.290.0040.01016.52
7.3.280.0080.01016.54
7.3.270.0150.00817.40
7.3.260.0100.00716.79
7.3.250.0100.00916.71
7.3.240.0110.00616.90
7.3.230.0040.01416.77
7.3.210.0160.00416.54
7.3.200.0120.00919.39
7.3.190.0070.01016.71
7.3.180.0090.01016.87
7.3.170.0100.00616.69
7.3.160.0140.00716.91
7.3.120.0040.01214.78
7.2.330.0150.00316.73
7.2.320.0030.01916.84
7.2.310.0130.01016.57
7.2.300.0130.00316.84
7.2.290.0000.01616.82
7.2.60.0130.00016.88
7.2.00.0040.01119.29
7.1.200.0040.00816.00
7.1.100.0090.00617.97
7.1.70.0100.00317.29
7.1.60.0100.01619.82
7.1.50.0030.01917.21
7.1.00.0070.07322.35
7.0.200.0040.00816.77
7.0.140.0000.07322.08
7.0.60.0330.07319.79
7.0.50.0000.09017.79
7.0.40.0030.05020.27
7.0.30.0200.08720.10
7.0.20.0400.05020.14
7.0.10.0270.08020.26
7.0.00.0170.07320.20
5.6.280.0030.07320.87
5.6.210.0100.07320.51
5.6.200.0100.05018.16
5.6.190.0030.06320.46
5.6.180.0070.03720.52
5.6.170.0200.03720.63
5.6.160.0030.06020.45
5.6.150.0170.07018.29
5.6.140.0070.07718.29
5.6.130.0030.08718.27
5.6.120.0100.08321.02
5.6.110.0070.08021.12
5.6.100.0200.03021.12
5.6.90.0100.08021.02
5.6.80.0170.07720.54
5.5.350.0070.03720.48
5.5.340.0030.05018.05
5.5.330.0030.04320.41
5.5.320.0370.07020.35
5.5.310.0130.04320.34
5.5.300.0030.03718.02
5.5.290.0030.06717.95
5.5.280.0030.06720.82
5.5.270.0030.07720.87
5.5.260.0130.07020.87
5.5.250.0100.08020.72
5.5.240.0230.07020.37
5.4.450.0000.04319.41
5.4.440.0400.05019.41
5.4.430.0230.04319.39
5.4.420.0630.05319.38
5.4.410.0130.05018.86
5.4.400.0100.05018.89
5.4.390.0230.04018.47
5.4.380.0200.05718.74
5.4.370.0300.04718.83
5.4.360.0300.04018.70
5.4.350.0200.05018.75
5.4.340.0230.05318.60
5.4.320.0100.04412.50
5.4.310.0070.04612.50
5.4.300.0060.04712.50
5.4.290.0070.03612.50
5.4.280.0070.03512.40
5.4.270.0050.03612.38
5.4.260.0040.03812.38
5.4.250.0060.03612.38
5.4.240.0070.03512.38
5.4.230.0070.03812.37
5.4.220.0050.03712.37
5.4.210.0070.03512.37
5.4.200.0070.04012.37
5.4.190.0080.04012.37
5.4.180.0070.03512.36
5.4.170.0060.03612.37
5.4.160.0060.03612.38
5.4.150.0050.03812.37
5.4.140.0050.03812.05
5.4.130.0070.03412.04
5.4.120.0050.03612.00
5.4.110.0070.03412.00
5.4.100.0060.03612.00
5.4.90.0050.03811.99
5.4.80.0040.04011.99
5.4.70.0080.03311.99
5.4.60.0100.04211.99
5.4.50.0060.03911.98
5.4.40.0080.03311.97
5.4.30.0080.04611.97
5.4.20.0060.03611.97
5.4.10.0050.03711.97
5.4.00.0070.03611.46
5.3.290.0080.04312.80
5.3.280.0080.03612.71
5.3.270.0060.03912.72
5.3.260.0040.04212.72
5.3.250.0070.03812.72
5.3.240.0080.03712.72
5.3.230.0100.04912.71
5.3.220.0060.03812.68
5.3.210.0060.04112.68
5.3.200.0080.03512.68
5.3.190.0060.03812.67
5.3.180.0030.04012.68
5.3.170.0080.03412.67
5.3.160.0050.03812.67
5.3.150.0060.04412.68
5.3.140.0080.03612.66
5.3.130.0100.03712.66
5.3.120.0060.03912.66
5.3.110.0070.03912.66
5.3.100.0070.03612.12
5.3.90.0050.03912.08
5.3.80.0050.03812.07
5.3.70.0080.03412.07
5.3.60.0050.03712.06
5.3.50.0070.03512.00
5.3.40.0040.03812.00
5.3.30.0060.03611.97
5.3.20.0080.03511.75
5.3.10.0040.04111.71
5.3.00.0060.04711.69
5.2.170.0040.0339.20
5.2.160.0050.0339.20
5.2.150.0040.0349.20
5.2.140.0080.0329.19
5.2.130.0080.0319.15
5.2.120.0090.0359.15
5.2.110.0040.0329.16
5.2.100.0080.0259.17
5.2.90.0020.0319.17
5.2.80.0070.0319.16
5.2.70.0060.0329.16
5.2.60.0020.0339.10
5.2.50.0050.0339.07
5.2.40.0060.0309.05
5.2.30.0060.0359.04
5.2.20.0070.0289.02
5.2.10.0040.0368.93
5.2.00.0070.0278.79
5.1.60.0050.0258.06
5.1.50.0020.0298.06
5.1.40.0080.0278.06
5.1.30.0050.0388.39
5.1.20.0050.0348.43
5.1.10.0030.0288.15
5.1.00.0060.0268.14
5.0.50.0060.0206.63
5.0.40.0060.0266.48
5.0.30.0020.0436.30
5.0.20.0070.0256.27
5.0.10.0090.0336.24
5.0.00.0050.0426.23
4.4.90.0020.0244.78
4.4.80.0050.0204.76
4.4.70.0020.0234.75
4.4.60.0070.0214.75
4.4.50.0020.0184.77
4.4.40.0040.0254.71
4.4.30.0050.0154.76
4.4.20.0020.0174.85
4.4.10.0050.0144.84
4.4.00.0040.0244.76
4.3.110.0020.0174.67
4.3.100.0030.0144.66
4.3.90.0010.0164.64
4.3.80.0040.0264.58
4.3.70.0030.0154.63
4.3.60.0020.0164.62
4.3.50.0010.0184.63
4.3.40.0020.0274.54
4.3.30.0020.0193.30
4.3.20.0010.0223.28
4.3.10.0020.0223.25
4.3.00.0130.01715.05

preferences:
44.66 ms | 401 KiB | 5 Q