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.0100.01018.55
8.3.50.0120.00922.09
8.3.40.0120.00318.88
8.3.30.0110.00419.21
8.3.20.0030.00620.22
8.3.10.0050.00321.92
8.3.00.0080.00022.43
8.2.180.0080.00816.38
8.2.170.0100.00322.96
8.2.160.0060.00919.08
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0100.01026.16
8.2.120.0040.00419.23
8.2.110.0040.00421.93
8.2.100.0090.00319.45
8.2.90.0040.00419.05
8.2.80.0040.00417.97
8.2.70.0090.00017.50
8.2.60.0050.00318.02
8.2.50.0080.00018.07
8.2.40.0030.00618.22
8.2.30.0040.00418.14
8.2.20.0040.00417.78
8.2.10.0040.00417.66
8.2.00.0040.00417.70
8.1.280.0130.00725.92
8.1.270.0050.00222.19
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0060.00324.04
8.1.230.0080.00319.11
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0050.00217.52
8.1.180.0040.00418.67
8.1.170.0000.00818.65
8.1.160.0040.00422.05
8.1.150.0050.00318.59
8.1.140.0030.00617.45
8.1.130.0030.00317.82
8.1.120.0030.00317.40
8.1.110.0000.00717.47
8.1.100.0040.00417.38
8.1.90.0070.00017.44
8.1.80.0040.00417.35
8.1.70.0000.00617.43
8.1.60.0000.00817.58
8.1.50.0040.00417.44
8.1.40.0050.00317.44
8.1.30.0000.00717.67
8.1.20.0090.00017.50
8.1.10.0000.00717.59
8.1.00.0050.00217.49
8.0.300.0000.00718.77
8.0.290.0040.00417.04
8.0.280.0030.00318.25
8.0.270.0030.00317.07
8.0.260.0000.00816.87
8.0.250.0030.00616.91
8.0.240.0050.00316.96
8.0.230.0000.00716.96
8.0.220.0040.00416.77
8.0.210.0000.00716.79
8.0.200.0040.00416.88
8.0.190.0000.00816.91
8.0.180.0070.00016.86
8.0.170.0040.00416.91
8.0.160.0070.00016.88
8.0.150.0060.00316.82
8.0.140.0000.00716.75
8.0.130.0030.00313.28
8.0.120.0030.00616.86
8.0.110.0030.00516.85
8.0.100.0040.00416.72
8.0.90.0040.00416.94
8.0.80.0130.00716.88
8.0.70.0040.00416.69
8.0.60.0020.00516.84
8.0.50.0040.00416.88
8.0.30.0110.00816.96
8.0.20.0120.00717.40
8.0.10.0040.00416.89
8.0.00.0090.00916.74
7.4.330.0050.00015.00
7.4.320.0000.00716.53
7.4.300.0000.00616.40
7.4.290.0050.00216.43
7.4.280.0000.00716.55
7.4.270.0030.00316.52
7.4.260.0030.00316.38
7.4.250.0040.00416.53
7.4.240.0040.00416.47
7.4.230.0030.00316.68
7.4.220.0000.01716.57
7.4.210.0100.00416.63
7.4.200.0000.00716.63
7.4.190.0070.00016.47
7.4.160.0140.00416.34
7.4.150.0040.01417.40
7.4.140.0070.01417.86
7.4.130.0120.00516.49
7.4.120.0100.00616.49
7.4.110.0110.00716.50
7.4.100.0130.00316.41
7.4.90.0000.01716.50
7.4.80.0080.01119.39
7.4.70.0120.00616.42
7.4.60.0060.00916.53
7.4.50.0090.00016.18
7.4.40.0110.00322.77
7.4.30.0110.00416.26
7.4.10.0070.01114.84
7.4.00.0050.01114.89
7.3.330.0000.00513.24
7.3.320.0000.00513.45
7.3.310.0000.00716.23
7.3.300.0030.00316.34
7.3.290.0110.00416.36
7.3.280.0070.00816.36
7.3.270.0050.01017.40
7.3.260.0110.00716.39
7.3.250.0050.01316.51
7.3.240.0110.00516.37
7.3.230.0100.01016.39
7.3.210.0070.01016.43
7.3.200.0090.00719.39
7.3.190.0150.00816.47
7.3.180.0030.01316.64
7.3.170.0090.00916.46
7.3.160.0090.00616.32
7.3.130.0030.01414.76
7.3.120.0100.00814.75
7.3.110.0070.01114.92
7.3.100.0090.00714.91
7.3.90.0090.00514.68
7.3.80.0080.00514.81
7.3.70.0070.00914.76
7.3.60.0040.01114.92
7.3.50.0090.00514.96
7.3.40.0090.00514.69
7.3.30.0020.01214.84
7.3.20.0050.00616.65
7.3.10.0080.00616.53
7.3.00.0040.00816.70
7.2.330.0130.00316.55
7.2.320.0030.01316.66
7.2.310.0040.01216.59
7.2.300.0050.01016.41
7.2.290.0090.00916.48
7.2.260.0100.01015.19
7.2.250.0070.01215.06
7.2.240.0080.01015.00
7.2.230.0070.01114.93
7.2.220.0080.00815.10
7.2.210.0030.01115.15
7.2.200.0020.00714.92
7.2.190.0030.01414.94
7.2.180.0050.00914.96
7.2.170.0070.00814.95
7.2.160.0030.01214.82
7.2.150.0030.00716.99
7.2.140.0100.00316.93
7.2.130.0070.01016.98
7.2.120.0120.00016.91
7.2.110.0090.00616.95
7.2.100.0030.01016.70
7.2.90.0070.00717.06
7.2.80.0000.01316.83
7.2.70.0040.00816.77
7.2.60.0040.00717.02
7.2.50.0070.00716.87
7.2.40.0030.01216.99
7.2.30.0000.01017.08
7.2.20.0110.00417.01
7.2.10.0030.01316.63
7.2.00.0050.00718.31
7.1.330.0110.00415.55
7.1.320.0030.01215.64
7.1.310.0050.00715.79
7.1.300.0050.01215.58
7.1.290.0040.00915.66
7.1.280.0090.00615.78
7.1.270.0030.01315.77
7.1.260.0050.00815.71
7.1.250.0100.00315.61
7.1.240.0060.00615.60
7.1.230.0060.00615.93
7.1.220.0080.00815.78
7.1.210.0070.01015.81
7.1.200.0070.00515.82
7.1.190.0040.01115.95
7.1.180.0030.01015.83
7.1.170.0060.00315.77
7.1.160.0060.00615.93
7.1.150.0090.00615.71
7.1.140.0080.00015.88
7.1.130.0040.00815.87
7.1.120.0100.00715.88
7.1.110.0030.01015.57
7.1.100.0050.00917.02
7.1.90.0030.01015.92
7.1.80.0090.00015.84
7.1.70.0000.01116.52
7.1.60.0090.00917.91
7.1.50.0050.01416.35
7.1.40.0000.00915.76
7.1.30.0140.00015.86
7.1.20.0070.00715.85
7.1.10.0120.00315.98
7.1.00.0050.04119.04
7.0.330.0030.00615.20
7.0.320.0120.00015.21
7.0.310.0070.00715.40
7.0.300.0070.00715.32
7.0.290.0030.00915.36
7.0.280.0030.00615.25
7.0.270.0000.01215.63
7.0.260.0000.01115.39
7.0.250.0040.01115.49
7.0.240.0110.00415.57
7.0.230.0030.00615.49
7.0.220.0070.00715.61
7.0.210.0070.00715.33
7.0.200.0060.00415.93
7.0.190.0060.00615.27
7.0.180.0040.00815.55
7.0.170.0030.00715.44
7.0.160.0030.01015.42
7.0.150.0090.00315.27
7.0.140.0020.04218.62
7.0.130.0070.00715.45
7.0.120.0030.00715.53
7.0.110.0070.00715.43
7.0.100.0030.00615.57
7.0.90.0000.01215.56
7.0.80.0000.01215.41
7.0.70.0000.00815.39
7.0.60.0020.04317.72
7.0.50.0070.03416.62
7.0.40.0080.03116.86
7.0.30.0190.03116.83
7.0.20.0180.04316.89
7.0.10.0070.02716.79
7.0.00.0080.02316.89
5.6.400.0000.01414.70
5.6.390.0030.00614.14
5.6.380.0030.00714.36
5.6.370.0030.00714.24
5.6.360.0040.00714.28
5.6.350.0040.00714.45
5.6.340.0000.00914.32
5.6.330.0040.01114.11
5.6.320.0040.00814.62
5.6.310.0070.00414.37
5.6.300.0000.01614.17
5.6.290.0080.00414.05
5.6.280.0060.03817.95
5.6.270.0000.00914.55
5.6.260.0060.00914.90
5.6.250.0030.00614.66
5.6.240.0030.00914.41
5.6.230.0100.00314.38
5.6.220.0060.00614.46
5.6.210.0030.04617.43
5.6.200.0050.04116.08
5.6.190.0070.02317.33
5.6.180.0050.04317.49
5.6.170.0130.02217.51
5.6.160.0070.02817.37
5.6.150.0050.04216.35
5.6.140.0060.04616.21
5.6.130.0070.04016.21
5.6.120.0050.03617.81
5.6.110.0080.04017.71
5.6.100.0020.02717.75
5.6.90.0070.04817.64
5.6.80.0040.02317.30
5.6.70.0060.00314.22
5.6.60.0040.01114.28
5.6.50.0170.00014.50
5.6.40.0060.00614.60
5.6.30.0030.01014.22
5.6.20.0030.00614.23
5.6.10.0060.00914.38
5.6.00.0000.01414.43
5.5.380.0060.00613.96
5.5.370.0000.01114.23
5.5.360.0100.00314.36
5.5.350.0080.04017.48
5.5.340.0120.03716.12
5.5.330.0080.03617.53
5.5.320.0150.02817.19
5.5.310.0230.04017.50
5.5.300.0070.02516.33
5.5.290.0070.02316.22
5.5.280.0100.04117.74
5.5.270.0050.04717.49
5.5.260.0030.02717.73
5.5.250.0140.03817.42
5.5.240.0030.04117.23
5.5.230.0100.00314.34
5.5.220.0080.00814.44
5.5.210.0040.01114.32
5.5.200.0090.00313.95
5.5.190.0070.00714.12
5.5.180.0030.01314.43
5.5.170.0070.00614.43
5.5.160.0080.00814.49
5.5.150.0060.00913.98
5.5.140.0030.01514.50
5.5.130.0070.01014.34
5.5.120.0030.01314.16
5.5.110.0060.00614.27
5.5.100.0140.00014.50
5.5.90.0060.01214.34
5.5.80.0000.01314.41
5.5.70.0070.01014.24
5.5.60.0070.01014.07
5.5.50.0090.00614.05
5.5.40.0130.00014.15
5.5.30.0080.00714.56
5.5.20.0070.00714.30
5.5.10.0000.01414.11
5.5.00.0070.00714.14
5.4.450.0430.01715.29
5.4.440.0260.02415.15
5.4.430.0360.02415.31
5.4.420.0340.02215.43
5.4.410.0490.02315.18
5.4.400.0180.02015.22
5.4.390.0180.01615.10
5.4.380.0280.02214.97
5.4.370.0200.03214.81
5.4.360.0190.03814.85
5.4.350.0260.02714.93
5.4.340.0200.03115.03
5.4.330.0140.00711.09
5.4.320.0020.02611.88
5.4.310.0080.02511.85
5.4.300.0050.02511.87
5.4.290.0090.02211.86
5.4.280.0090.02111.75
5.4.270.0090.02011.79
5.4.260.0050.03114.95
5.4.250.0090.02915.22
5.4.240.0120.02715.10
5.4.230.0090.02814.92
5.4.220.0050.03115.17
5.4.210.0100.02815.03
5.4.200.0090.02814.98
5.4.190.0120.03714.97
5.4.180.0120.02714.86
5.4.170.0160.02215.04
5.4.160.0120.02415.03
5.4.150.0200.02414.81
5.4.140.0100.03313.85
5.4.130.0100.03913.87
5.4.120.0040.04613.71
5.4.110.0090.04213.80
5.4.100.0110.03513.70
5.4.90.0080.02813.85
5.4.80.0080.03313.68
5.4.70.0100.03813.89
5.4.60.0120.02513.86
5.4.50.0110.03613.81
5.4.40.0080.03013.90
5.4.30.0090.02813.80
5.4.20.0080.03013.73
5.4.10.0060.03013.76
5.4.00.0090.02713.36
5.3.290.0050.02511.77
5.3.280.0060.04312.56
5.3.270.0070.03112.66
5.3.260.0070.03112.73
5.3.250.0070.04312.52
5.3.240.0090.02912.59
5.3.230.0120.02712.62
5.3.220.0090.02712.53
5.3.210.0060.03212.60
5.3.200.0100.03712.58
5.3.190.0110.02512.63
5.3.180.0040.04012.65
5.3.170.0050.03012.70
5.3.160.0050.03112.71
5.3.150.0070.03012.55
5.3.140.0120.03512.50
5.3.130.0030.03612.50
5.3.120.0030.03512.43
5.3.110.0080.04412.45
5.3.100.0060.03112.45
5.3.90.0120.02612.45
5.3.80.0080.03812.17
5.3.70.0080.02512.34
5.3.60.0070.02812.29
5.3.50.0060.03012.27
5.3.40.0130.02312.20
5.3.30.0090.03712.35
5.3.20.0070.03012.07
5.3.10.0100.03811.93
5.3.00.0030.04112.05
5.2.170.0000.04311.20
5.2.160.0030.04011.20
5.2.150.0000.04711.13
5.2.140.0030.04311.20
5.2.130.0070.05710.93
5.2.120.0100.03711.18
5.2.110.0000.06011.19
5.2.100.0070.04011.00
5.2.90.0030.04711.00
5.2.80.0030.04711.15
5.2.70.0170.04311.25
5.2.60.0130.04010.96
5.2.50.0100.05011.01
5.2.40.0030.04311.22
5.2.30.0070.04010.95
5.2.20.0130.04011.04
5.2.10.0030.04010.76
5.2.00.0030.04010.88
5.1.60.0000.04010.09
5.1.50.0000.0409.83
5.1.40.0100.03010.13
5.1.30.0070.03310.50
5.1.20.0030.05010.43
5.1.10.0030.05010.17
5.1.00.0100.03710.27
5.0.50.0070.0378.53
5.0.40.0100.0308.46
5.0.30.0000.0438.38
5.0.20.0030.0308.29
5.0.10.0000.0308.24
5.0.00.0000.0408.41
4.4.90.0030.0206.57
4.4.80.0000.0336.57
4.4.70.0100.0176.57
4.4.60.0000.0236.57
4.4.50.0000.0236.57
4.4.40.0030.0336.57
4.4.30.0000.0276.57
4.4.20.0030.0206.57
4.4.10.0030.0206.57
4.4.00.0070.0406.57
4.3.110.0030.0206.57
4.3.100.0000.0336.57
4.3.90.0000.0236.57
4.3.80.0070.0376.57
4.3.70.0000.0236.57
4.3.60.0030.0206.57
4.3.50.0000.0236.57
4.3.40.0000.0336.54
4.3.30.0000.0276.51
4.3.20.0030.0236.51
4.3.10.0030.0206.51
4.3.00.0030.01013.05

preferences:
49.67 ms | 401 KiB | 5 Q