3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param string $str the string to encode and parse for URLs */ function preventXssAndParseAnchors(string $str): string { $url_regex = "/\b((https?:\/\/?|www\.)[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/"; // Encoding HTML special characters To prevent XSS // Before parsing the URLs to Anchors $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); preg_match_all($url_regex, $str, $urls); foreach ($urls[0] as $url) { $str = str_replace($url, "<a href='$url'>$url</a>", $str); } return $str; } $str = " apply here https://ph.dbsd.com/job/dfvdfg/5444 <script> console.log('this is a hacking attempt hacking'); </script> and www.google.com also http://somesite.net "; echo preventXssAndParseAnchors($str);

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.10.0080.01018.69
8.5.00.0100.01220.34
8.4.150.0020.00114.05
8.4.140.0170.00518.07
8.4.130.0160.00419.03
8.4.120.0060.00524.29
8.4.110.0090.00818.95
8.4.100.0060.00319.13
8.4.90.0130.00920.52
8.4.80.0030.00518.90
8.4.70.0030.00618.81
8.4.60.0110.00518.91
8.4.50.0060.00918.62
8.4.40.0060.01319.73
8.4.30.0090.00020.41
8.4.20.0140.00718.11
8.4.10.0040.00420.72
8.3.280.0160.00518.35
8.3.270.0140.00616.68
8.3.260.0110.00816.64
8.3.250.0100.01019.09
8.3.240.0080.01117.11
8.3.230.0140.00616.62
8.3.220.0140.00419.04
8.3.210.0120.00718.64
8.3.200.0030.00516.79
8.3.190.0120.00920.75
8.3.180.0110.00818.68
8.3.170.0120.00320.51
8.3.160.0030.01517.16
8.3.150.0090.00916.73
8.3.140.0060.00318.79
8.3.130.0080.00018.49
8.3.120.0000.01120.74
8.3.110.0250.00816.68
8.3.100.0280.00816.54
8.3.90.0200.01019.99
8.3.80.0170.01116.75
8.3.70.0260.00516.63
8.3.60.0260.00716.50
8.3.50.0210.00817.80
8.3.40.0200.00518.05
8.3.30.0190.00720.04
8.3.20.0200.00419.68
8.3.10.0150.00120.05
8.3.00.0110.00321.14
8.2.290.0050.00420.51
8.2.280.0040.00518.70
8.2.270.0030.01516.83
8.2.260.0110.00716.62
8.2.250.0080.00016.82
8.2.240.0000.00818.72
8.2.230.0150.00417.98
8.2.220.0180.00719.19
8.2.210.0140.00619.85
8.2.200.0200.00416.49
8.2.190.0200.00616.67
8.2.180.0180.00719.56
8.2.170.0160.00219.52
8.2.160.0170.00919.56
8.2.150.0260.00220.39
8.2.140.0160.01019.97
8.2.130.0180.00720.51
8.2.120.0200.00418.74
8.2.110.0210.00618.73
8.2.100.0250.00417.76
8.2.90.0200.00817.82
8.2.80.0180.00918.13
8.2.70.0170.00817.72
8.2.60.0180.00717.63
8.2.50.0220.00317.81
8.2.40.0180.00517.88
8.2.30.0170.00717.89
8.2.20.0200.01018.61
8.2.10.0190.00917.77
8.2.00.0240.00418.22
8.1.330.0070.00222.05
8.1.320.0110.00918.32
8.1.310.0060.01216.37
8.1.300.0060.00316.50
8.1.290.0240.00321.14
8.1.280.0200.00519.34
8.1.270.0220.00519.56
8.1.260.0210.00720.40
8.1.250.0140.00521.06
8.1.240.0120.00419.19
8.1.230.0170.00418.57
8.1.220.0180.00417.57
8.1.210.0190.00617.84
8.1.200.0160.00717.27
8.1.190.0160.00717.27
8.1.180.0170.00817.48
8.1.170.0190.00617.80
8.1.160.0200.00517.76
8.1.150.0210.00917.72
8.1.140.0190.01017.40
8.1.130.0170.00817.95
8.1.120.0220.00317.56
8.1.110.0190.00717.43
8.1.100.0150.00917.46
8.1.90.0180.00617.44
8.1.80.0150.01017.51
8.1.70.0170.00517.53
8.1.60.0180.00817.57
8.1.50.0140.00417.57
8.1.40.0130.00417.67
8.1.30.0190.00617.65
8.1.20.0200.00517.66
8.1.10.0190.00617.58
8.1.00.0200.00517.52
8.0.300.0230.00318.32
8.0.290.0230.00516.74
8.0.280.0210.00117.20
8.0.270.0160.00617.18
8.0.260.0130.00616.98
8.0.250.0120.00717.04
8.0.240.0130.00616.90
8.0.230.0140.00616.94
8.0.220.0140.00616.86
8.0.210.0170.00416.94
8.0.200.0120.00716.93
8.0.190.0150.00516.82
8.0.180.0090.00617.02
8.0.170.0100.00516.92
8.0.160.0130.00316.91
8.0.150.0130.00416.99
8.0.140.0150.00216.94
8.0.130.0130.00516.85
8.0.120.0150.00616.91
8.0.110.0160.00716.89
8.0.100.0200.00416.89
8.0.90.0190.00516.92
8.0.80.0160.00516.84
8.0.70.0150.00616.90
8.0.60.0170.00516.82
8.0.50.0130.00816.94
8.0.30.0180.00416.94
8.0.20.0170.00616.98
8.0.10.0150.00517.01
7.4.330.0140.00416.48
7.4.320.0210.00316.74
7.4.300.0170.00416.74
7.4.290.0140.00616.75
7.4.280.0190.00516.75
7.4.270.0220.00416.74
7.4.260.0170.00716.78
7.4.250.0190.00616.73
7.4.240.0170.00616.75
7.4.230.0200.00316.74
7.4.220.0160.00616.75
7.4.210.0190.00516.69
7.4.200.0180.00516.75
7.4.190.0160.00516.83
7.4.180.0150.00616.83
7.4.160.0180.00716.81
7.4.150.0180.00616.71
7.4.140.0220.00416.75
7.4.130.0200.00616.69
7.4.120.0200.00516.68
7.4.110.0170.00616.72
7.4.100.0150.00616.79
7.4.90.0170.00516.69
7.4.80.0150.00816.72
7.4.70.0160.00516.76
7.4.60.0140.00416.75
7.4.50.0180.00316.73
7.4.40.0130.00516.62
7.4.30.0130.00616.72
7.4.20.0170.00516.63
7.4.10.0150.00516.72
7.4.00.0170.00116.70

preferences:
40.21 ms | 403 KiB | 5 Q