3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray = array( 'sub1.sub2.example.co.uk', 'sub1.example.com', 'example.com', 'sub1.sub2.sub3.example.co.uk', 'sub1.sub2.sub3.example.com', 'sub1.sub2.example.com' ); foreach($testArray as $k => $v) { echo $k." => ".extract_domain($v)."\n"; } function extract_domain($domain) { if(preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i", $domain, $matches)) { return $matches['domain']; } else { return $domain; } } function extract_subdomains($domain) { $subdomains = $domain; $domain = extract_domain($subdomains); $subdomains = rtrim(strstr($subdomains, $domain, true), '.'); return $subdomains; }

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.0150.00617.00
8.3.50.0110.01122.99
8.3.40.0070.01118.95
8.3.30.0040.01119.21
8.3.20.0000.00720.21
8.3.10.0040.00423.36
8.3.00.0050.00317.75
8.2.180.0160.00016.63
8.2.170.0110.00422.96
8.2.160.0070.00720.45
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0140.00426.16
8.2.120.0070.00321.02
8.2.110.0060.00322.20
8.2.100.0070.00418.03
8.2.90.0040.00419.29
8.2.80.0050.00317.97
8.2.70.0030.00617.73
8.2.60.0080.00018.05
8.2.50.0060.00318.07
8.2.40.0100.00018.22
8.2.30.0060.00318.20
8.2.20.0060.00317.97
8.2.10.0000.00718.16
8.2.00.0000.00817.98
8.1.280.0110.00325.92
8.1.270.0100.00023.99
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.84
8.1.230.0060.00619.16
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0000.00818.73
8.1.160.0040.00421.96
8.1.150.0000.00718.86
8.1.140.0070.00017.63
8.1.130.0070.00017.91
8.1.120.0000.00817.52
8.1.110.0030.00617.66
8.1.100.0030.00417.45
8.1.90.0070.00017.52
8.1.80.0000.00817.67
8.1.70.0000.00717.58
8.1.60.0030.00617.78
8.1.50.0050.00317.73
8.1.40.0000.00817.61
8.1.30.0040.00417.71
8.1.20.0050.00317.79
8.1.10.0000.00717.72
8.1.00.0030.00617.70
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.39
8.0.270.0050.00217.16
8.0.260.0060.00017.35
8.0.250.0070.00017.12
8.0.240.0040.00417.12
8.0.230.0030.00317.11
8.0.220.0000.00717.09
8.0.210.0060.00017.09
8.0.200.0030.00517.03
8.0.190.0050.00217.06
8.0.180.0000.00717.01
8.0.170.0030.00616.93
8.0.160.0050.00317.06
8.0.150.0050.00217.04
8.0.140.0050.00317.01
8.0.130.0030.00313.33
8.0.120.0040.00417.03
8.0.110.0050.00317.10
8.0.100.0040.00416.84
8.0.90.0040.00416.96
8.0.80.0100.01016.93
8.0.70.0040.00416.95
8.0.60.0070.00016.94
8.0.50.0070.00017.07
8.0.30.0060.01317.40
8.0.20.0170.00617.46
8.0.10.0000.00816.98
8.0.00.0090.00916.91
7.4.330.0030.00315.00
7.4.320.0000.00816.85
7.4.300.0030.00316.86
7.4.290.0030.00316.71
7.4.280.0050.00316.70
7.4.270.0030.00316.87
7.4.260.0000.00716.79
7.4.250.0050.00316.74
7.4.240.0020.00516.69
7.4.230.0040.00416.85
7.4.220.0100.01016.64
7.4.210.0070.00716.77
7.4.200.0040.00416.89
7.4.160.0100.00716.88
7.4.150.0140.00617.40
7.4.140.0180.01617.86
7.4.130.0140.00516.85
7.4.120.0080.00916.76
7.4.110.0070.01016.77
7.4.100.0040.01416.93
7.4.90.0130.00316.80
7.4.80.0100.00919.39
7.4.70.0120.00616.55
7.4.60.0100.01316.91
7.4.50.0040.00016.80
7.4.40.0060.01316.79
7.4.30.0110.00716.65
7.4.00.0110.00415.13
7.3.330.0000.00713.31
7.3.320.0050.00013.39
7.3.310.0040.00416.49
7.3.300.0030.00316.60
7.3.290.0140.00016.37
7.3.280.0090.00816.43
7.3.270.0100.00717.40
7.3.260.0120.00616.83
7.3.250.0080.01116.66
7.3.240.0140.00316.62
7.3.230.0070.01016.62
7.3.210.0100.00616.51
7.3.200.0090.01119.39
7.3.190.0070.01116.64
7.3.180.0140.00316.76
7.3.170.0090.00616.59
7.3.160.0060.00916.47
7.3.10.0120.00316.58
7.3.00.0040.01116.71
7.2.330.0120.00617.00
7.2.320.0110.00716.68
7.2.310.0160.00816.93
7.2.300.0070.01016.77
7.2.290.0060.01116.80
7.2.130.0120.00916.94
7.2.120.0120.00616.52
7.2.110.0110.00416.71
7.2.100.0130.00717.14
7.2.90.0030.01416.91
7.2.80.0100.00717.08
7.2.70.0130.01016.63
7.2.60.0060.01016.69
7.2.50.0160.01016.98
7.2.40.0090.00616.85
7.2.30.0080.00517.01
7.2.20.0080.00817.34
7.2.10.0100.00916.89
7.2.00.0080.00718.23
7.1.250.0000.01216.04
7.1.100.0000.01217.93
7.1.70.0040.00417.54
7.1.60.0070.01119.40
7.1.50.0150.00417.15
7.1.00.0000.08022.48
7.0.200.0680.00615.01
7.0.140.0100.06322.00
7.0.60.0130.08019.93
7.0.50.0130.08317.89
7.0.40.0000.05320.32
7.0.30.0270.04020.17
7.0.20.0170.05320.12
7.0.10.0070.04720.09
7.0.00.0100.05020.13
5.6.280.0100.06720.92
5.6.210.0030.04020.67
5.6.200.0130.08318.19
5.6.190.0100.03720.52
5.6.180.0300.04020.50
5.6.170.0370.07020.51
5.6.160.0100.04320.54
5.6.150.0070.04018.14
5.6.140.0170.06718.16
5.6.130.0070.05018.18
5.6.120.0000.04321.02
5.6.110.0030.04321.01
5.6.100.0200.06321.03
5.6.90.0130.08021.04
5.6.80.0030.07720.47
5.5.350.0070.06020.34
5.5.340.0070.06018.09
5.5.330.0000.04720.26
5.5.320.0270.07320.33
5.5.310.0370.07020.36
5.5.300.0070.04318.02
5.5.290.0030.04018.07
5.5.280.0130.07720.69
5.5.270.0030.07020.77
5.5.260.0070.08320.85
5.5.250.0070.07320.47
5.5.240.0270.07020.16
5.4.450.0200.04319.54
5.4.440.0570.06019.36
5.4.430.0400.04719.54
5.4.420.0270.04019.49
5.4.410.0600.05019.34
5.4.400.0530.03719.22
5.4.390.0070.04719.15
5.4.380.0130.06018.74
5.4.370.0170.04718.77
5.4.360.0130.05018.61
5.4.350.0200.05718.51
5.4.340.0170.05018.59
5.4.320.0070.03512.51
5.4.310.0040.03912.50
5.4.300.0060.03612.51
5.4.290.0030.04012.51
5.4.280.0050.03812.40
5.4.270.0050.03712.41
5.4.260.0050.04012.40
5.4.250.0100.03512.41
5.4.240.0080.04112.40
5.4.230.0010.04212.39
5.4.220.0040.03712.39
5.4.210.0050.03612.39
5.4.200.0060.03812.39
5.4.190.0030.03912.39
5.4.180.0050.03512.39
5.4.170.0050.03612.40
5.4.160.0060.03512.39
5.4.150.0060.04112.39
5.4.140.0040.03812.07
5.4.130.0070.03412.06
5.4.120.0080.03312.02
5.4.110.0040.03612.02
5.4.100.0070.03312.01
5.4.90.0040.03712.02
5.4.80.0040.03712.02
5.4.70.0060.03412.02
5.4.60.0060.03412.01
5.4.50.0030.03812.01
5.4.40.0040.03512.00
5.4.30.0050.03612.00
5.4.20.0050.03611.99
5.4.10.0050.03412.00
5.4.00.0050.04411.49
5.3.290.0060.03912.80
5.3.280.0070.03512.71
5.3.270.0060.03812.73
5.3.260.0060.03912.72
5.3.250.0070.03612.72
5.3.240.0040.04012.71
5.3.230.0030.04412.71
5.3.220.0030.04112.68
5.3.210.0060.03812.68
5.3.200.0050.03812.68
5.3.190.0060.03812.68
5.3.180.0080.03812.67
5.3.170.0030.03912.67
5.3.160.0050.03712.67
5.3.150.0020.04112.68
5.3.140.0030.03912.66
5.3.130.0030.04112.66
5.3.120.0060.03912.66
5.3.110.0050.04112.66
5.3.100.0050.03812.13
5.3.90.0070.03612.11
5.3.80.0040.03912.11
5.3.70.0040.03812.11
5.3.60.0050.03712.09
5.3.50.0070.03612.04
5.3.40.0040.03812.04
5.3.30.0060.03512.00
5.3.20.0040.03711.79
5.3.10.0080.03311.74
5.3.00.0040.04311.73
5.2.170.0070.0289.24
5.2.160.0040.0309.24
5.2.150.0050.0309.23
5.2.140.0060.0299.23
5.2.130.0040.0309.20
5.2.120.0020.0319.20
5.2.110.0040.0309.20
5.2.100.0050.0289.20
5.2.90.0010.0399.20
5.2.80.0090.0269.20
5.2.70.0030.0329.19
5.2.60.0050.0299.15
5.2.50.0060.0299.11
5.2.40.0010.0329.10
5.2.30.0040.0309.07
5.2.20.0060.0279.07
5.2.10.0040.0288.95
5.2.00.0040.0298.82
5.1.60.0040.0248.10
5.1.50.0040.0248.09
5.1.40.0050.0238.07
5.1.30.0050.0258.42
5.1.20.0040.0268.44
5.1.10.0050.0248.17
5.1.00.0050.0258.17
5.0.50.0030.0216.65
5.0.40.0030.0256.51
5.0.30.0050.0306.32
5.0.20.0030.0206.29
5.0.10.0070.0166.27
5.0.00.0030.0316.26
4.4.90.0040.0134.78
4.4.80.0040.0144.76
4.4.70.0040.0144.75
4.4.60.0020.0164.75
4.4.50.0030.0154.77
4.4.40.0040.0244.71
4.4.30.0030.0164.76
4.4.20.0020.0214.84
4.4.10.0030.0154.85
4.4.00.0020.0284.76
4.3.110.0040.0154.67
4.3.100.0030.0144.67
4.3.90.0030.0144.63
4.3.80.0000.0274.58
4.3.70.0010.0164.63
4.3.60.0010.0164.63
4.3.50.0030.0154.63
4.3.40.0030.0234.53
4.3.30.0020.0163.31
4.3.20.0020.0163.29
4.3.10.0020.0153.25
4.3.00.0030.02015.98

preferences:
48.31 ms | 401 KiB | 5 Q