3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_domain($url) { if ( !preg_match("/^http/", $url) ) $url = 'http://' . $url; if ( $url[strlen($url)-1] != '/' ) $url .= '/'; $pieces = parse_url($url); $domain = isset($pieces['host']) ? $pieces['host'] : ''; if ( preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs) ) { $res = preg_replace('/^www\./', '', $regs['domain'] ); return $res; } return false; } var_dump(get_domain('http://onlinephpfunctions.com/index.php'));

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.0140.00718.57
8.3.50.0110.00421.20
8.3.40.0070.00719.06
8.3.30.0030.01020.34
8.3.20.0120.00319.07
8.3.10.0000.00821.13
8.3.00.0080.00022.45
8.2.180.0090.00616.75
8.2.170.0040.01122.96
8.2.160.0080.00620.38
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0110.00326.16
8.2.120.0070.00021.17
8.2.110.0090.00021.17
8.2.100.0070.00417.84
8.2.90.0040.00419.25
8.2.80.0050.00319.39
8.2.70.0000.00817.88
8.2.60.0030.00518.05
8.2.50.0030.00518.07
8.2.40.0000.00818.22
8.2.30.0060.00618.21
8.2.20.0000.00817.97
8.2.10.0000.00717.87
8.2.00.0030.00518.04
8.1.280.0210.00025.92
8.1.270.0030.00623.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0040.00722.01
8.1.230.0090.00320.86
8.1.220.0000.00818.77
8.1.210.0050.00319.01
8.1.200.0000.00917.47
8.1.190.0000.00817.53
8.1.180.0000.00918.10
8.1.170.0050.00318.82
8.1.160.0000.00718.94
8.1.150.0060.00318.81
8.1.140.0040.00417.50
8.1.130.0000.00717.75
8.1.120.0030.00717.63
8.1.110.0040.00417.64
8.1.100.0070.00017.54
8.1.90.0040.00417.52
8.1.80.0000.00817.63
8.1.70.0030.00317.53
8.1.60.0050.00317.77
8.1.50.0090.00017.68
8.1.40.0040.00417.60
8.1.30.0000.00917.84
8.1.20.0040.00417.86
8.1.10.0000.00817.71
8.1.00.0000.00717.67
8.0.300.0050.00319.94
8.0.290.0050.00316.73
8.0.280.0000.00718.41
8.0.270.0070.00017.26
8.0.260.0030.00316.90
8.0.250.0030.00317.01
8.0.240.0080.00017.13
8.0.230.0030.00317.00
8.0.220.0070.00017.11
8.0.210.0040.00417.09
8.0.200.0000.00717.18
8.0.190.0040.00417.02
8.0.180.0040.00417.09
8.0.170.0000.00717.07
8.0.160.0000.00717.10
8.0.150.0040.00417.07
8.0.140.0000.00717.05
8.0.130.0060.00013.54
8.0.120.0030.00516.97
8.0.110.0050.00216.88
8.0.100.0080.00016.93
8.0.90.0040.00417.04
8.0.80.0080.00717.11
8.0.70.0030.00516.95
8.0.60.0000.00817.10
8.0.50.0000.00717.05
8.0.30.0130.00617.42
8.0.20.0150.00517.40
8.0.10.0080.00017.20
8.0.00.0090.01016.99
7.4.330.0050.00016.84
7.4.320.0000.00716.84
7.4.300.0070.00016.86
7.4.290.0030.00316.68
7.4.280.0030.00316.80
7.4.270.0070.00016.83
7.4.260.0030.00313.50
7.4.250.0030.00516.75
7.4.240.0070.00016.89
7.4.230.0000.00716.65
7.4.220.0170.01016.84
7.4.210.0090.00716.82
7.4.200.0000.00716.84
7.4.190.0000.00716.89
7.4.160.0100.00616.81
7.4.150.0060.01217.40
7.4.140.0090.01117.86
7.4.130.0090.00916.73
7.4.120.0110.00616.71
7.4.110.0090.00916.51
7.4.100.0090.01316.79
7.4.90.0040.01516.69
7.4.80.0040.01319.39
7.4.70.0090.00916.75
7.4.60.0070.01016.92
7.4.50.0040.00016.75
7.4.40.0090.00922.77
7.4.30.0100.00916.69
7.4.00.0030.01315.32
7.3.330.0030.00213.39
7.3.320.0000.00613.40
7.3.310.0050.00216.66
7.3.300.0030.00316.55
7.3.290.0140.00016.57
7.3.280.0100.00716.55
7.3.270.0070.01117.40
7.3.260.0090.01118.24
7.3.250.0080.00916.54
7.3.240.0140.00316.55
7.3.230.0150.00616.48
7.3.210.0190.00316.76
7.3.200.0150.00619.39
7.3.190.0000.01816.89
7.3.180.0140.00716.29
7.3.170.0030.01316.62
7.3.160.0100.00716.69
7.3.120.0120.00314.83
7.2.330.0110.00616.72
7.2.320.0090.01316.58
7.2.310.0150.00316.87
7.2.300.0140.00316.69
7.2.290.0040.01416.88
7.2.00.0170.01019.52
7.1.100.0030.00718.31
7.1.70.0000.00717.44
7.1.60.0000.01017.22
7.1.50.0000.02017.21
7.1.00.0000.08022.33
7.0.200.0110.00416.90
7.0.140.0030.06721.95
7.0.60.0030.07719.88
7.0.50.0030.07018.00
7.0.40.0070.04320.20
7.0.30.0230.04320.27
7.0.20.0200.07720.22
7.0.10.0130.08020.24
7.0.00.0130.08020.11
5.6.280.0000.07721.02
5.6.210.0030.08320.67
5.6.200.0030.04018.25
5.6.190.0070.09320.55
5.6.180.0500.07020.64
5.6.170.0370.08020.47
5.6.160.0100.07320.71
5.6.150.0030.04718.28
5.6.140.0230.05018.14
5.6.130.0130.07718.15
5.6.120.0170.05020.99
5.6.110.0100.08021.10
5.6.100.0100.07720.98
5.6.90.0070.06321.13
5.6.80.0170.05020.48
5.5.350.0130.07720.53
5.5.340.0070.08318.09
5.5.330.0030.08720.31
5.5.320.0130.04020.36
5.5.310.0200.04320.37
5.5.300.0100.06717.95
5.5.290.0070.06017.98
5.5.280.0000.04320.90
5.5.270.0000.04320.86
5.5.260.0230.07320.96
5.5.250.0070.04320.59
5.5.240.0030.07320.13
5.4.450.0030.07019.29
5.4.440.2370.04319.46
5.4.430.1900.03019.32
5.4.420.2130.03319.48
5.4.410.2100.03719.26
5.4.400.1870.04019.23
5.4.390.2430.04318.84
5.4.380.0930.05318.84
5.4.370.0130.06319.24
5.4.360.0030.07318.99
5.4.350.2070.04319.09
5.4.340.1430.04319.13
5.4.320.2270.03719.00
5.4.310.2100.05319.31
5.4.300.2070.05019.14
5.4.290.2170.04018.95
5.4.280.2030.04019.21
5.4.270.1970.04318.84
5.4.260.2170.04018.98
5.4.250.1030.04719.08
5.4.240.0030.05318.97
5.4.230.0000.04719.16
5.4.220.1770.04019.23
5.4.210.1900.04018.99
5.4.200.2100.03018.98
5.4.190.1930.04719.04
5.4.180.1830.04719.07
5.4.170.2330.04318.98
5.4.160.1930.03719.11
5.4.150.1830.04319.12
5.4.140.2300.03316.44
5.4.130.1930.03716.38
5.4.120.0630.05316.38
5.4.110.0030.07716.63
5.4.100.0430.04016.61
5.4.90.2200.03716.42
5.4.80.1870.03016.49
5.4.70.2170.03716.49
5.4.60.1900.03316.56
5.4.50.2000.04316.33
5.4.40.2070.04016.53
5.4.30.2000.04016.25
5.4.20.2200.04016.34
5.4.10.2130.03716.50
5.4.00.1830.03715.80
5.3.290.0070.07314.67
5.3.280.0030.04014.51
5.3.270.0870.04314.51
5.3.260.2030.03314.53
5.3.250.1970.03714.51
5.3.240.2170.04314.54
5.3.230.1930.03714.60
5.3.220.2270.03714.48
5.3.210.1930.04314.54
5.3.200.1670.04014.57
5.3.190.2030.03314.57
5.3.180.2270.03714.55
5.3.170.1570.04014.46
5.3.160.0030.03714.47
5.3.150.0100.04714.46
5.3.140.1530.05314.67
5.3.130.2030.04314.63
5.3.120.2400.03714.69
5.3.110.1930.04314.45
5.3.100.2370.04014.12
5.3.90.2230.03314.17
5.3.80.2030.03013.96
5.3.70.2230.04313.92
5.3.60.2200.04013.98
5.3.50.1900.03313.96
5.3.40.0070.07313.85
5.3.30.0030.03314.00
5.3.20.0870.03713.60
5.3.10.1970.03013.80
5.3.00.1930.03313.54
5.2.170.1630.03011.26
5.2.160.1730.02311.06
5.2.150.2100.02711.15
5.2.140.1930.03311.23
5.2.130.1500.03711.01
5.2.120.2000.02310.97
5.2.110.1800.03011.09
5.2.100.1470.03311.01
5.2.90.1800.03711.18
5.2.80.0030.04311.07
5.2.70.0000.03011.01
5.2.60.0030.03311.14
5.2.50.1500.03010.92
5.2.40.1230.03310.89
5.2.30.1270.03011.05
5.2.20.1400.02310.86
5.2.10.1630.03010.83
5.2.00.1370.03010.71
5.1.60.1600.0209.94
5.1.50.1470.03710.12
5.1.40.1270.02710.06
5.1.30.1500.03310.42
5.1.20.1330.02310.42
5.1.10.1570.02310.00
5.1.00.1470.0379.96
5.0.50.0600.0238.63
5.0.40.0170.0238.39
5.0.30.0130.0238.20
5.0.20.0070.0408.08
5.0.10.0070.0408.16
5.0.00.0030.0408.06
4.4.90.0070.0238.04
4.4.80.0000.0238.04
4.4.70.0000.0208.04
4.4.60.0770.0138.04
4.4.50.0770.0238.04
4.4.40.0800.0308.04
4.4.30.0730.0178.04
4.4.20.0670.0138.04
4.4.10.0630.0178.04
4.4.00.0670.0238.04
4.3.110.0700.0108.04
4.3.100.0800.0238.04
4.3.90.0700.0208.04
4.3.80.0500.0278.04
4.3.70.0730.0208.04
4.3.60.0800.0138.04
4.3.50.0770.0038.04
4.3.40.0700.0238.04
4.3.30.0000.0178.04
4.3.20.0000.0338.04
4.3.10.0000.0278.04
4.3.00.0000.0178.04

preferences:
43.62 ms | 400 KiB | 5 Q