3v4l.org

run code in 300+ PHP versions simultaneously
<?php function esip($ip_addr) { //first of all the format of the ip address is matched if(preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$ip_addr)) { //now all the intger values are separated $parts=explode(".",$ip_addr); //now we need to check each part can range from 0-255 foreach($parts as $ip_parts) { if(intval($ip_parts)>255 || intval($ip_parts)<0) return FALSE; //if number is not within range of 0-255 } return TRUE; } else return FALSE; //if format of ip address doesn't matches } function domain($domainb) { $bits = explode('/', $domainb); if ($bits[0]=='http:' || $bits[0]=='https:') { $domainb= $bits[2]; } else { $domainb= $bits[0]; } unset($bits); $bits = explode('.', $domainb); $idz=count($bits); $idz-=3; if (strlen($bits[($idz+2)])==2) { $url=$bits[$idz].'.'.$bits[($idz+1)].'.'.$bits[($idz+2)]; } else if (strlen($bits[($idz+2)])==0) { $url=$bits[($idz)].'.'.$bits[($idz+1)]; } else { $url=$bits[($idz+1)].'.'.$bits[($idz+2)]; } return $url; } $address='clients1.sub3.google.co.uk'; $parsed_url = parse_url($address); $check = esip($parsed_url['host']); $host = $parsed_url['host']; if ($check == FALSE){ if ($host != ""){ $host = domain($host); }else{ $host = domain($address); } } echo $host;

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.00716.88
8.3.50.0120.00821.36
8.3.40.0040.01119.11
8.3.30.0120.00318.91
8.3.20.0080.00020.32
8.3.10.0070.00023.65
8.3.00.0040.00422.32
8.2.180.0130.00618.79
8.2.170.0110.00722.96
8.2.160.0100.00322.14
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00321.16
8.2.110.0100.00021.04
8.2.100.0040.00818.09
8.2.90.0060.00319.36
8.2.80.0000.00817.97
8.2.70.0040.00417.88
8.2.60.0060.00318.05
8.2.50.0030.00518.10
8.2.40.0000.00821.17
8.2.30.0040.00419.85
8.2.20.0080.00017.90
8.2.10.0080.00018.30
8.2.00.0040.00418.07
8.1.280.0040.01125.92
8.1.270.0060.00320.27
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.62
8.1.230.0040.00717.70
8.1.220.0000.00817.78
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0060.00317.48
8.1.180.0050.00318.10
8.1.170.0040.00418.63
8.1.160.0040.00421.97
8.1.150.0000.00718.85
8.1.140.0000.00717.59
8.1.130.0000.00717.66
8.1.120.0000.00717.64
8.1.110.0000.00717.63
8.1.100.0000.00717.54
8.1.90.0000.00717.50
8.1.80.0040.00417.63
8.1.70.0040.00417.61
8.1.60.0060.00317.80
8.1.50.0060.00317.59
8.1.40.0060.00317.71
8.1.30.0000.00817.81
8.1.20.0000.00817.67
8.1.10.0030.00517.72
8.1.00.0050.00517.67
8.0.300.0050.00318.77
8.0.290.0040.00416.88
8.0.280.0030.00318.43
8.0.270.0080.00017.14
8.0.260.0000.00618.48
8.0.250.0050.00317.12
8.0.240.0070.00017.11
8.0.230.0030.00317.14
8.0.220.0000.00717.14
8.0.210.0050.00317.11
8.0.200.0070.00017.05
8.0.190.0040.00417.16
8.0.180.0070.00017.04
8.0.170.0040.00417.12
8.0.160.0000.00717.21
8.0.150.0000.00817.05
8.0.140.0000.00717.06
8.0.130.0000.00513.54
8.0.120.0000.00816.97
8.0.110.0040.00417.14
8.0.100.0000.00717.06
8.0.90.0040.00416.95
8.0.80.0110.00717.17
8.0.70.0000.00717.02
8.0.60.0030.00517.06
8.0.50.0000.00817.05
8.0.30.0070.01117.45
8.0.20.0110.00817.40
8.0.10.0070.00017.20
8.0.00.0150.00817.01
7.4.330.0000.00515.08
7.4.320.0000.00616.87
7.4.300.0000.00616.71
7.4.290.0030.00316.71
7.4.280.0040.00416.72
7.4.270.0050.00316.74
7.4.260.0070.00016.69
7.4.250.0000.00816.80
7.4.240.0020.00516.74
7.4.230.0050.00316.91
7.4.220.0160.01016.87
7.4.210.0000.01516.88
7.4.200.0000.00716.76
7.4.160.0100.00616.79
7.4.150.0070.01117.40
7.4.140.0110.01117.86
7.4.130.0090.00916.79
7.4.120.0110.00616.75
7.4.110.0160.00016.75
7.4.100.0150.00316.77
7.4.90.0080.00816.75
7.4.80.0190.00019.39
7.4.70.0130.00316.84
7.4.60.0100.00616.68
7.4.50.0060.00316.52
7.4.40.0080.00916.96
7.4.30.0070.01116.86
7.4.00.0030.01315.04
7.3.330.0000.00513.57
7.3.320.0050.00013.49
7.3.310.0000.00816.43
7.3.300.0000.00716.51
7.3.290.0080.00816.58
7.3.280.0090.00916.60
7.3.270.0130.00417.40
7.3.260.0050.01416.75
7.3.250.0100.00816.57
7.3.240.0130.01016.92
7.3.230.0090.00816.80
7.3.210.0140.00316.74
7.3.200.0080.00816.58
7.3.190.0090.01216.86
7.3.180.0180.00016.74
7.3.170.0090.00716.50
7.3.160.0100.00716.55
7.3.10.0160.00316.46
7.3.00.0120.00816.40
7.2.330.0130.00616.83
7.2.320.0140.01016.90
7.2.310.0130.00616.91
7.2.300.0090.00916.96
7.2.290.0040.01516.89
7.2.130.0130.00617.02
7.2.120.0150.00316.94
7.2.110.0130.00316.52
7.2.100.0170.00016.80
7.2.90.0110.00517.32
7.2.80.0100.01316.98
7.2.70.0090.00616.77
7.2.60.0030.01017.16
7.2.50.0070.01116.88
7.2.40.0100.01317.05
7.2.30.0100.01517.16
7.2.20.0140.00316.91
7.2.10.0160.00817.16
7.2.00.0140.00618.30
7.1.250.0100.00715.84
7.1.200.0090.00315.94
7.1.100.0060.00618.54
7.1.70.0000.00717.30
7.1.60.0110.01419.18
7.1.50.0100.01617.10
7.1.00.0130.06722.47
7.0.200.0250.00716.55
7.0.110.0170.04719.87
7.0.100.0030.07319.85
7.0.90.0070.05719.96
7.0.80.0000.06319.92
7.0.70.0100.08019.85
7.0.60.0070.05720.01
7.0.50.0100.06719.93
7.0.40.0070.05019.65
7.0.30.0130.07319.68
7.0.20.0070.03719.82
7.0.10.0030.04319.86
7.0.00.0000.06019.82
5.6.280.0030.03021.12
5.6.260.0000.07020.62
5.6.250.0100.07020.66
5.6.240.0130.06020.68
5.6.230.0030.04720.59
5.6.220.0030.04020.66
5.6.210.0070.07020.63
5.6.200.0070.05020.67
5.6.190.0130.07720.65
5.6.180.0200.06320.57
5.6.170.0100.07320.71
5.6.160.0070.05320.58
5.6.150.0130.02720.63
5.6.140.0130.06320.56
5.6.130.0070.07720.53
5.6.120.0130.03020.69
5.6.110.0070.03320.67
5.6.100.0030.08720.56
5.6.90.0070.04320.46
5.6.80.0070.06320.08
5.6.70.0070.05020.00
5.6.60.0070.03320.24
5.6.50.0030.08019.86
5.6.40.0070.06020.23
5.6.30.0100.03320.08
5.6.20.0030.03720.00
5.6.10.0000.04019.99
5.6.00.0000.03720.01
5.5.380.0070.06317.70
5.5.370.0100.06017.64
5.5.360.0000.07717.68
5.5.350.0030.05017.66
5.5.340.0100.07018.10
5.5.330.0030.08018.10
5.5.320.0100.06718.05
5.5.310.0100.03018.09
5.5.300.0070.03318.10
5.5.290.0000.06017.83
5.5.280.0070.03718.23
5.5.270.0100.07717.95
5.5.260.0070.03718.09
5.5.250.0100.05017.74
5.5.240.0030.08017.49
5.5.230.0170.07017.51
5.5.220.0030.07317.47
5.5.210.0030.03717.48
5.5.200.0030.03317.59
5.5.190.0100.05317.28
5.5.180.0100.07317.19
5.5.160.0130.06017.31
5.5.150.0100.07717.28
5.5.140.0100.04317.45
5.5.130.0000.03717.48
5.5.120.0030.06017.26
5.5.110.0070.07717.57
5.5.100.0100.07317.38
5.5.90.0000.04017.21
5.5.80.0100.05717.38
5.5.70.0000.05317.16
5.5.60.0000.04717.49
5.5.50.0070.03317.20
5.5.40.0000.03717.33
5.5.30.0070.05717.36
5.5.20.0000.05317.34
5.5.10.0000.04017.36
5.5.00.0000.04317.14
5.4.450.0030.08319.34
5.4.440.0130.04019.66
5.4.430.0030.04019.64
5.4.420.0030.03719.50
5.4.410.0130.05719.18
5.4.400.0030.07319.14
5.4.390.0100.05019.22
5.4.380.0100.05319.17
5.4.370.0070.03319.00
5.4.360.0000.03719.18
5.4.350.0070.04318.95
5.4.340.0030.05019.02
5.4.320.0070.07319.18
5.4.310.0030.07319.24
5.4.300.0070.03718.90
5.4.290.0030.04019.18
5.4.280.0000.08019.18
5.4.270.0030.05719.18
5.4.260.0070.03719.18
5.4.250.0070.07019.23
5.4.240.0070.03319.14
5.4.230.0030.05719.17
5.4.220.0100.05319.17
5.4.210.0070.06719.23
5.4.200.0000.06719.00
5.4.190.0100.06318.99
5.4.180.0100.03019.13
5.4.170.0000.05719.30
5.4.160.0000.04019.29
5.4.150.0070.03318.96
5.4.140.0000.04016.61
5.4.130.0030.03316.67
5.4.120.0070.03016.39
5.4.110.0000.04016.48
5.4.100.0070.03316.37
5.4.90.0100.02316.46
5.4.80.0030.03716.40
5.4.70.0030.05316.54
5.4.60.0030.04016.42
5.4.50.0070.04716.48
5.4.40.0030.04716.33
5.4.30.0070.05316.51
5.4.20.0000.03016.52
5.4.10.0130.02716.47
5.4.00.0000.04015.73
5.3.290.0130.04714.81
5.3.280.0000.04314.75
5.3.270.0070.04314.75
5.3.260.0100.03014.66
5.3.250.0030.03714.56
5.3.240.0100.03014.76
5.3.230.0070.03314.57
5.3.220.0030.03714.61
5.3.210.0030.03714.71
5.3.200.0030.03014.66
5.3.190.0030.03714.71
5.3.180.0070.03314.80
5.3.170.0000.03714.81
5.3.160.0000.03314.54
5.3.150.0130.05714.68
5.3.140.0030.04014.70
5.3.130.0030.05714.57
5.3.120.0030.03314.57
5.3.110.0030.03714.57
5.3.100.0030.03714.04
5.3.90.0030.03014.16
5.3.80.0070.03314.04
5.3.70.0070.03314.04
5.3.60.0000.05013.97
5.3.50.0000.04013.83
5.3.40.0070.03314.02
5.3.30.0000.03713.94
5.3.20.0030.03313.74
5.3.10.0000.03313.79
5.3.00.0100.02313.62
5.2.170.0000.03012.07
5.2.160.0030.03012.07
5.2.150.0030.03012.07
5.2.140.0030.02312.07
5.2.130.0100.02012.07
5.2.120.0030.02312.07
5.2.110.0000.02712.07
5.2.100.0070.02312.07
5.2.90.0030.02712.07
5.2.80.0030.02312.07
5.2.70.0000.02712.07
5.2.60.0000.02712.07
5.2.50.0000.02712.07
5.2.40.0030.02712.07
5.2.30.0000.02712.07
5.2.20.0030.02312.07
5.2.10.0030.02312.07
5.2.00.0000.02312.07
5.1.60.0030.02012.07
5.1.50.0030.02012.07
5.1.40.0000.02012.07
5.1.30.0000.02312.07
5.1.20.0030.02012.07
5.1.10.0170.01312.07
5.1.00.0000.03312.07
5.0.50.0030.02312.07
5.0.40.0000.01712.07
5.0.30.0030.02312.07
5.0.20.0000.01712.07
5.0.10.0030.01712.07
5.0.00.0000.02712.07
4.4.90.0000.01312.07
4.4.80.0000.01312.07
4.4.70.0030.01012.07
4.4.60.0000.01312.07
4.4.50.0000.01312.07
4.4.40.0030.02012.07
4.4.30.0030.01312.07
4.4.20.0000.01312.07
4.4.10.0000.02312.07
4.4.00.0030.02312.07
4.3.110.0000.01312.07
4.3.100.0000.01712.07
4.3.90.0000.01312.07
4.3.80.0000.02012.07
4.3.70.0000.01312.07
4.3.60.0000.01312.07
4.3.50.0000.01312.07
4.3.40.0000.02312.07
4.3.30.0070.00712.07
4.3.20.0070.00712.07
4.3.10.0030.01312.07
4.3.00.0000.01312.07

preferences:
67.48 ms | 401 KiB | 5 Q