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]; if($i != count($fullArray)-1) $string1 .= '.'; } $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.0070.01418.68
8.3.50.0120.00521.07
8.3.40.0100.01018.62
8.3.30.0130.00319.07
8.3.20.0060.00320.30
8.3.10.0060.00321.92
8.3.00.0040.00420.69
8.2.180.0090.01216.50
8.2.170.0110.00422.96
8.2.160.0070.00719.05
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.01026.16
8.2.120.0030.00717.63
8.2.110.0090.00019.45
8.2.100.0120.00017.91
8.2.90.0040.00419.23
8.2.80.0040.00417.97
8.2.70.0070.00717.48
8.2.60.0050.00317.92
8.2.50.0000.00818.07
8.2.40.0050.00518.22
8.2.30.0040.00418.19
8.2.20.0080.00017.71
8.2.10.0040.00417.63
8.2.00.0050.00317.77
8.1.280.0040.01625.92
8.1.270.0040.00422.20
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0000.00921.39
8.1.230.0060.00617.52
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0000.00917.23
8.1.190.0040.00417.23
8.1.180.0040.00718.59
8.1.170.0040.00418.63
8.1.160.0000.00722.02
8.1.150.0000.00718.64
8.1.140.0000.00717.45
8.1.130.0030.00717.93
8.1.120.0000.00717.46
8.1.110.0000.00817.34
8.1.100.0040.00417.35
8.1.90.0000.00817.32
8.1.80.0030.00317.39
8.1.70.0030.00317.34
8.1.60.0030.00517.46
8.1.50.0000.00817.41
8.1.40.0030.00517.55
8.1.30.0040.00417.52
8.1.20.0040.00417.61
8.1.10.0000.00817.47
8.1.00.0060.00317.52
8.0.300.0060.00318.77
8.0.290.0070.00016.63
8.0.280.0000.00718.27
8.0.270.0030.00317.16
8.0.260.0000.00716.77
8.0.250.0040.00416.88
8.0.240.0000.00716.96
8.0.230.0030.00316.79
8.0.220.0070.00016.74
8.0.210.0020.00516.72
8.0.200.0040.00416.80
8.0.190.0000.00916.81
8.0.180.0030.00516.84
8.0.170.0030.00516.85
8.0.160.0000.00816.73
8.0.150.0040.00416.82
8.0.140.0000.00716.71
8.0.130.0060.00013.32
8.0.120.0050.00316.75
8.0.110.0000.00816.94
8.0.100.0070.00017.00
8.0.90.0050.00216.84
8.0.80.0120.00316.96
8.0.70.0020.00516.96
8.0.60.0000.00716.69
8.0.50.0000.00816.70
8.0.30.0120.00717.09
8.0.20.0110.00917.40
8.0.10.0000.00717.00
8.0.00.0080.01016.82
7.4.330.0000.00515.15
7.4.320.0060.00016.61
7.4.300.0030.00316.50
7.4.290.0060.00316.56
7.4.280.0000.00716.64
7.4.270.0000.00716.61
7.4.260.0030.00316.54
7.4.250.0000.00716.46
7.4.240.0020.00516.55
7.4.230.0070.00016.61
7.4.220.0070.01016.68
7.4.210.0050.01116.54
7.4.200.0070.00016.66
7.4.190.0000.00716.67
7.4.160.0110.01116.28
7.4.150.0090.00817.40
7.4.140.0100.00717.86
7.4.130.0100.00716.51
7.4.120.0090.00816.48
7.4.110.0150.00316.61
7.4.100.0110.01116.51
7.4.90.0100.00716.38
7.4.80.0070.01019.39
7.4.70.0070.01116.47
7.4.60.0150.00316.46
7.4.50.0000.00716.55
7.4.40.0090.00922.77
7.4.30.0150.00416.41
7.4.00.0040.00714.89
7.3.330.0050.00013.21
7.3.320.0020.00213.33
7.3.310.0070.00016.27
7.3.300.0040.00416.43
7.3.290.0110.00416.33
7.3.280.0090.01016.35
7.3.270.0090.00917.40
7.3.260.0120.00616.68
7.3.250.0130.00816.42
7.3.240.0000.01716.38
7.3.230.0070.01416.61
7.3.210.0110.00916.41
7.3.200.0120.00419.39
7.3.190.0130.00316.29
7.3.180.0070.01316.51
7.3.170.0130.00316.29
7.3.160.0070.01016.51
7.3.120.0070.01115.07
7.3.110.0030.01314.76
7.3.100.0070.01115.03
7.3.90.0030.00614.70
7.3.80.0070.00714.87
7.3.70.0100.00314.73
7.3.60.0130.00314.96
7.3.50.0060.00914.81
7.3.40.0030.01314.59
7.3.30.0030.00614.86
7.3.20.0040.00716.68
7.3.10.0100.00316.72
7.3.00.0030.00916.62
7.2.330.0140.00316.66
7.2.320.0090.01216.70
7.2.310.0100.00616.81
7.2.300.0110.00616.67
7.2.290.0090.01516.71
7.2.240.0070.00715.32
7.2.230.0030.01315.02
7.2.220.0070.01015.08
7.2.210.0070.01314.97
7.2.200.0030.01014.96
7.2.190.0090.00915.04
7.2.180.0000.01015.10
7.2.170.0080.00815.13
7.2.160.0030.01015.16
7.2.150.0110.00316.95
7.2.140.0100.00716.73
7.2.130.0040.01116.71
7.2.120.0110.00516.88
7.2.110.0040.00816.97
7.2.100.0050.00816.87
7.2.90.0090.00517.03
7.2.80.0050.00816.96
7.2.70.0070.00816.75
7.2.60.0030.01116.89
7.2.50.0090.00717.02
7.2.40.0000.01717.04
7.2.30.0020.01117.12
7.2.20.0130.00216.93
7.2.10.0110.00616.93
7.2.00.0050.01017.01
7.1.330.0030.01315.98
7.1.320.0080.00815.96
7.1.310.0040.01615.61
7.1.300.0070.01015.44
7.1.290.0040.00415.98
7.1.280.0030.01015.56
7.1.270.0030.01315.69
7.1.260.0100.00316.04
7.1.250.0100.00215.88
7.1.200.0040.00815.72
7.1.70.0050.00217.09
7.1.60.0100.01319.82
7.1.50.0070.01516.91
7.1.00.0030.07722.37
7.0.200.0040.00716.80
7.0.140.0000.07722.19
7.0.60.0070.04320.05
7.0.50.0130.07717.86
7.0.40.0130.03720.07
7.0.30.0300.07720.07
7.0.20.0330.08020.17
7.0.10.0000.05320.06
7.0.00.0170.03720.30
5.6.280.0070.06720.91
5.6.210.0070.08020.64
5.6.200.0100.06318.17
5.6.190.0070.08020.42
5.6.180.0200.04720.33
5.6.170.0270.07720.53
5.6.160.0130.04320.55
5.6.150.0030.03718.19
5.6.140.0170.06718.27
5.6.130.0130.08018.12
5.6.120.0100.08021.03
5.6.110.0070.08320.97
5.6.100.0070.08021.00
5.6.90.0070.08021.02
5.6.80.0100.06020.38
5.5.350.4130.04020.33
5.5.340.0000.04017.98
5.5.330.0130.07720.45
5.5.320.0270.07720.35
5.5.310.0270.06020.51
5.5.300.0070.05018.04
5.5.290.0070.08017.98
5.5.280.0000.08320.90
5.5.270.0100.03720.76
5.5.260.0100.08320.77
5.5.250.0100.07720.80
5.5.240.0070.06720.19
5.4.450.0970.04019.33
5.4.440.0330.04319.27
5.4.430.0370.05319.52
5.4.420.0330.04019.45
5.4.410.0330.05019.19
5.4.400.0400.03719.16
5.4.390.0700.04319.32
5.4.380.0430.05318.78
5.4.370.0500.05718.78
5.4.360.0530.05718.83
5.4.350.0270.05318.74
5.4.340.0400.04718.69
5.4.320.0080.04712.50
5.4.310.0080.03812.50
5.4.300.0060.04212.50
5.4.290.0050.04212.50
5.4.280.0070.04412.40
5.4.270.0090.04112.40
5.4.260.0030.05718.75
5.4.250.0130.05719.04
5.4.240.0200.04018.89
5.4.230.0170.05718.89
5.4.220.0130.05718.96
5.4.210.0070.05318.93
5.4.200.0170.04318.69
5.4.190.0070.05318.88
5.4.180.0130.06318.88
5.4.170.0100.07718.88
5.4.160.0070.05718.93
5.4.150.0100.07018.77
5.4.140.0070.07016.50
5.4.130.0230.04716.58
5.4.120.0000.06316.39
5.4.110.0130.07016.47
5.4.100.0070.06016.45
5.4.90.0070.05016.43
5.4.80.0100.04716.45
5.4.70.0100.05716.41
5.4.60.0100.05016.41
5.4.50.0100.04716.43
5.4.40.0070.05016.38
5.4.30.0100.04316.46
5.4.20.0100.04716.41
5.4.10.0000.07016.46
5.4.00.0100.05316.03
5.3.290.0070.03812.80
5.3.280.0070.05014.67
5.3.270.0070.05714.58
5.3.260.0000.07714.69
5.3.250.0200.06314.74
5.3.240.0100.06714.57
5.3.230.0170.04714.68
5.3.220.0070.05314.70
5.3.210.0130.05714.58
5.3.200.0070.07314.54
5.3.190.0000.06014.74
5.3.180.0130.05714.69
5.3.170.0070.05314.53
5.3.160.0130.04314.54
5.3.150.0070.05014.55
5.3.140.0100.05014.64
5.3.130.0100.04714.45
5.3.120.0070.05014.71
5.3.110.0070.05014.37
5.3.100.0130.04314.20
5.3.90.0030.05314.10
5.3.80.0130.04714.00
5.3.70.0100.05013.98
5.3.60.0070.05314.16
5.3.50.0070.07313.96
5.3.40.0130.04314.17
5.3.30.0100.04713.81
5.3.20.0070.04713.76
5.3.10.0070.04713.82
5.3.00.0200.06013.71
5.2.170.0130.04011.17
5.2.160.0030.06311.23
5.2.150.0030.04711.30
5.2.140.0030.04311.22
5.2.130.0000.04311.02
5.2.120.0000.05010.93
5.2.110.0100.05011.19
5.2.100.0000.04711.08
5.2.90.0070.04011.18
5.2.80.0130.04010.93
5.2.70.0030.06310.99
5.2.60.0070.05311.13
5.2.50.0070.04011.11
5.2.40.0100.03310.98
5.2.30.0170.04710.87
5.2.20.0070.05711.11
5.2.10.0000.04311.02
5.2.00.0070.03710.94
5.1.60.0070.05010.06
5.1.50.0130.02710.09
5.1.40.0170.0209.98
5.1.30.0070.03310.16
5.1.20.0030.03710.44
5.1.10.0030.04710.26
5.1.00.0100.0439.92
5.0.50.0070.0278.79
5.0.40.0030.0278.57
5.0.30.0000.0638.30
5.0.20.0030.0308.29
5.0.10.0100.0338.20
5.0.00.0030.0438.21
4.4.90.0000.0335.88
4.4.80.0000.0235.87
4.4.70.0030.0275.86
4.4.60.0030.0275.86
4.4.50.0030.0205.86
4.4.40.0030.0335.87
4.4.30.0030.0205.91
4.4.20.0030.0205.92
4.4.10.0030.0205.94
4.4.00.0000.0375.86
4.3.110.0030.0205.81
4.3.100.0000.0335.79
4.3.90.0070.0175.78
4.3.80.0000.0475.82
4.3.70.0070.0175.84
4.3.60.0030.0205.77
4.3.50.0030.0205.84
4.3.40.0070.0435.75
4.3.30.0000.0235.64
4.3.20.0030.0205.64
4.3.10.0000.0205.64
4.3.00.0000.01713.05

preferences:
48.46 ms | 401 KiB | 5 Q