3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_last_dot_occurence ($url ) { $fullArray = explode('.', $url); $newArray = ""; switch (count($fullArray)) { case 1: $newArray = $url; break; case 2: $newArray = array("string1" => $fullArray[0], "string2" => $fullArray[1]); break; default: $string1 = ""; for ($i=0; $i < count($fullArray); $i++) { $string1 .= $fullArray[$i].'.'; } $newArray = $string1; break; } return $newArray; } print_r(get_last_dot_occurence("test.com")); print_r(get_last_dot_occurence("1.2.test.com"));

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.0120.00918.18
8.3.50.0100.01022.05
8.3.40.0080.00818.83
8.3.30.0110.00719.04
8.3.20.0080.00019.94
8.3.10.0040.00422.05
8.3.00.0050.00322.38
8.2.180.0110.00416.32
8.2.170.0110.00322.96
8.2.160.0120.00319.21
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0110.00326.16
8.2.120.0070.00319.36
8.2.110.0090.00022.29
8.2.100.0130.00019.38
8.2.90.0040.00419.16
8.2.80.0040.00418.04
8.2.70.0000.00817.50
8.2.60.0060.00318.16
8.2.50.0000.00818.07
8.2.40.0000.00718.34
8.2.30.0070.00018.17
8.2.20.0040.00417.78
8.2.10.0050.00217.75
8.2.00.0070.00017.77
8.1.280.0130.00725.92
8.1.270.0040.00422.02
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0030.00623.79
8.1.230.0090.00318.99
8.1.220.0030.00717.77
8.1.210.0080.00018.77
8.1.200.0080.00017.35
8.1.190.0000.00717.53
8.1.180.0080.00018.65
8.1.170.0000.00818.59
8.1.160.0000.00722.05
8.1.150.0040.00418.60
8.1.140.0080.00017.36
8.1.130.0000.00717.74
8.1.120.0030.00317.32
8.1.110.0000.00717.44
8.1.100.0000.00717.41
8.1.90.0000.00717.46
8.1.80.0030.00317.46
8.1.70.0030.00317.34
8.1.60.0000.00817.48
8.1.50.0050.00317.54
8.1.40.0050.00317.52
8.1.30.0000.00717.58
8.1.20.0040.00417.72
8.1.10.0060.00317.59
8.1.00.0080.00017.53
8.0.300.0070.00018.77
8.0.290.0000.00717.29
8.0.280.0030.00318.45
8.0.270.0000.00717.12
8.0.260.0000.00616.77
8.0.250.0000.00717.00
8.0.240.0000.00716.95
8.0.230.0000.00716.95
8.0.220.0000.00716.87
8.0.210.0030.00416.92
8.0.200.0030.00316.92
8.0.190.0000.00916.95
8.0.180.0040.00416.91
8.0.170.0030.00616.89
8.0.160.0040.00416.93
8.0.150.0080.00016.89
8.0.140.0040.00416.86
8.0.130.0050.00013.34
8.0.120.0030.00616.78
8.0.110.0050.00316.80
8.0.100.0000.00816.80
8.0.90.0040.00416.78
8.0.80.0000.01516.82
8.0.70.0040.00416.88
8.0.60.0050.00316.72
8.0.50.0040.00416.77
8.0.30.0080.01316.91
8.0.20.0090.01117.40
8.0.10.0040.00416.87
8.0.00.0080.01016.67
7.4.330.0030.00315.00
7.4.320.0000.00816.45
7.4.300.0000.00616.54
7.4.290.0030.00316.60
7.4.280.0030.00316.40
7.4.270.0000.00716.50
7.4.260.0070.00016.63
7.4.250.0030.00516.44
7.4.240.0020.00616.49
7.4.230.0000.00716.68
7.4.220.0070.01116.64
7.4.210.0100.00616.53
7.4.200.0000.00716.61
7.4.190.0000.00816.75
7.4.160.0100.00716.50
7.4.150.0170.00017.40
7.4.140.0070.01317.86
7.4.130.0130.00516.54
7.4.120.0100.00716.48
7.4.110.0090.00916.43
7.4.100.0100.00716.43
7.4.90.0180.00016.51
7.4.80.0140.00619.39
7.4.70.0100.01016.29
7.4.60.0060.00916.35
7.4.50.0040.00416.60
7.4.40.0100.00722.77
7.4.30.0100.00616.64
7.4.00.0030.01314.74
7.3.330.0000.00513.45
7.3.320.0000.00513.17
7.3.310.0030.00316.41
7.3.300.0050.00316.32
7.3.290.0030.01116.33
7.3.280.0060.01116.35
7.3.270.0030.01317.40
7.3.260.0080.01116.61
7.3.250.0130.01016.48
7.3.240.0060.01016.46
7.3.230.0070.01316.39
7.3.210.0110.00716.21
7.3.200.0090.00619.39
7.3.190.0030.01216.44
7.3.180.0120.00916.71
7.3.170.0060.00916.44
7.3.160.0090.00616.50
7.3.120.0090.00614.79
7.3.10.0030.01016.55
7.3.00.0130.00016.77
7.2.330.0090.00916.68
7.2.320.0130.00316.66
7.2.310.0140.00316.83
7.2.300.0000.01616.76
7.2.290.0130.00616.79
7.2.130.0050.00516.95
7.2.120.0070.00816.85
7.2.110.0040.01116.82
7.2.100.0070.01016.95
7.2.90.0090.00616.95
7.2.80.0030.01017.08
7.2.70.0070.00316.95
7.2.60.0090.00616.69
7.2.50.0070.00716.51
7.2.40.0040.00716.95
7.2.30.0080.00616.94
7.2.20.0040.00816.79
7.2.10.0100.00016.69
7.2.00.0070.01016.96
7.1.250.0070.00715.86
7.1.100.0080.00318.03
7.1.70.0040.00417.34
7.1.60.0070.01719.82
7.1.50.0110.01116.70
7.1.00.0030.07322.33
7.0.200.0050.00316.92
7.0.140.0000.07721.96
7.0.60.0130.04020.02
7.0.50.0000.04317.89
7.0.40.0000.05020.18
7.0.30.0330.04320.17
7.0.20.0330.04720.38
7.0.10.0270.07320.12
7.0.00.0030.04720.24
5.6.280.0000.09721.08
5.6.210.0100.07320.77
5.6.200.0100.05318.12
5.6.190.0030.05020.34
5.6.180.3200.04320.51
5.6.170.0230.04720.47
5.6.160.0100.08020.46
5.6.150.0100.06718.19
5.6.140.0070.09018.18
5.6.130.0000.05318.23
5.6.120.0030.06721.15
5.6.110.0200.07021.09
5.6.100.0000.08320.89
5.6.90.0130.08021.04
5.6.80.0100.05020.42
5.6.70.4530.04020.38
5.5.350.0030.08020.45
5.5.340.0070.03717.94
5.5.330.0130.07720.41
5.5.320.0230.08020.52
5.5.310.0330.06320.34
5.5.300.0100.08317.91
5.5.290.0130.07017.95
5.5.280.0070.09020.90
5.5.270.0030.06020.86
5.5.260.0100.07720.89
5.5.250.0030.04320.77
5.5.240.0100.07720.35
5.4.450.0430.06719.55
5.4.440.0570.06319.44
5.4.430.0330.05319.30
5.4.420.0570.04019.30
5.4.410.0130.05019.48
5.4.400.1030.00018.50
5.4.390.0630.00018.74
5.4.380.0400.05318.61
5.4.370.0170.05018.56
5.4.360.0200.06018.63
5.4.350.0400.06718.77
5.4.340.0330.04318.61
5.4.320.0150.04712.51
5.4.310.0050.03812.50
5.4.300.0080.03412.50
5.4.290.0080.04212.50
5.4.280.0050.04212.40
5.4.270.0070.03412.40
5.4.260.0130.06018.84
5.4.250.0100.04719.09
5.4.240.0070.05318.99
5.4.230.0070.08318.99
5.4.220.0030.06018.95
5.4.210.0130.05018.99
5.4.200.0030.06318.95
5.4.190.0070.05018.92
5.4.180.0070.05319.00
5.4.170.0100.05018.83
5.4.160.0130.05018.73
5.4.150.0070.05318.83
5.4.140.0070.05716.52
5.4.130.0030.06016.52
5.4.120.0130.04316.50
5.4.110.0030.05316.46
5.4.100.0130.04716.39
5.4.90.0070.07316.41
5.4.80.0100.07016.48
5.4.70.0130.04316.47
5.4.60.0030.05016.45
5.4.50.0100.06016.31
5.4.40.0100.05016.58
5.4.30.0230.05316.54
5.4.20.0130.04316.59
5.4.10.0130.04716.53
5.4.00.0230.04016.04
5.3.290.0060.04012.80
5.3.280.0030.05314.61
5.3.270.0070.05314.57
5.3.260.0030.05714.43
5.3.250.0030.05714.59
5.3.240.0030.07714.78
5.3.230.0000.07314.58
5.3.220.0070.05314.57
5.3.210.0070.05314.65
5.3.200.0030.05314.59
5.3.190.0070.05314.58
5.3.180.0030.05314.58
5.3.170.0130.04314.56
5.3.160.0030.05314.53
5.3.150.0070.05714.69
5.3.140.0130.04714.55
5.3.130.0070.08314.63
5.3.120.0030.05714.38
5.3.110.0130.07014.77
5.3.100.0030.05714.20
5.3.90.0100.05014.19
5.3.80.0100.05014.20
5.3.70.0070.05013.99
5.3.60.0100.06314.02
5.3.50.0100.05713.94
5.3.40.0030.05713.92
5.3.30.0100.04313.92
5.3.20.0130.04313.86
5.3.10.0130.06013.73
5.3.00.0100.04713.72
5.2.170.0130.03711.25
5.2.160.0130.03311.21
5.2.150.0070.04011.13
5.2.140.0070.04011.30
5.2.130.0070.05010.94
5.2.120.0000.04711.17
5.2.110.0030.05711.00
5.2.100.0070.03711.18
5.2.90.0030.06311.08
5.2.80.0000.04311.04
5.2.70.0000.04711.17
5.2.60.0130.03711.03
5.2.50.0030.04011.01
5.2.40.0070.03711.07
5.2.30.0130.03711.05
5.2.20.0100.03711.03
5.2.10.0130.03010.86
5.2.00.0070.04010.70
5.1.60.0100.03310.23
5.1.50.0100.03710.04
5.1.40.0070.0379.93
5.1.30.0070.03710.55
5.1.20.0000.05310.32
5.1.10.0070.03010.04
5.1.00.0030.03710.05
5.0.50.0000.0338.64
5.0.40.0000.0338.48
5.0.30.0070.0408.22
5.0.20.0000.0308.18
5.0.10.0070.0278.04
5.0.00.0030.0408.21
4.4.90.0070.0276.57
4.4.80.0030.0306.57
4.4.70.0070.0176.57
4.4.60.0030.0276.57
4.4.50.0100.0206.57
4.4.40.0070.0376.57
4.4.30.0070.0276.57
4.4.20.0030.0206.57
4.4.10.0000.0236.57
4.4.00.0000.0376.57
4.3.110.0000.0236.57
4.3.100.0030.0206.57
4.3.90.0100.0136.57
4.3.80.0070.0306.57
4.3.70.0000.0236.57
4.3.60.0030.0306.57
4.3.50.0070.0176.57
4.3.40.0000.0336.57
4.3.30.0000.0236.57
4.3.20.0030.0206.57
4.3.10.0070.0176.57
4.3.00.0100.0207.29

preferences:
49.21 ms | 401 KiB | 5 Q