3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n = '1.512.523,55'; function parseFloat($ptString) { if (strlen($ptString) == 0) { return false; } $pString = str_replace(" ", "", $ptString); if (substr_count($pString, ",") > 1) $pString = str_replace(",", "", $pString); if (substr_count($pString, ".") > 1) $pString = str_replace(".", "", $pString); $pregResult = array(); $commaset = strpos($pString,','); if ($commaset === false) {$commaset = -1;} $pointset = strpos($pString,'.'); if ($pointset === false) {$pointset = -1;} $pregResultA = array(); $pregResultB = array(); if ($pointset < $commaset) { preg_match('#(([-]?[0-9]+(\.[0-9])?)+(,[0-9]+)?)#', $pString, $pregResultA); } preg_match('#(([-]?[0-9]+(,[0-9])?)+(\.[0-9]+)?)#', $pString, $pregResultB); if ((isset($pregResultA[0]) && (!isset($pregResultB[0]) || @strstr($preResultA[0],$pregResultB[0]) == 0 || !$pointset))) { $numberString = $pregResultA[0]; $numberString = str_replace('.','',$numberString); $numberString = str_replace(',','.',$numberString); } elseif (isset($pregResultB[0]) && (!isset($pregResultA[0]) || strstr($pregResultB[0],$preResultA[0]) == 0 || !$commaset)) { $numberString = $pregResultB[0]; $numberString = str_replace(',','',$numberString); } else { return false; } $result = (float)$numberString; return $result; } echo parseFloat($n);

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.0110.00416.88
8.3.50.0150.00817.64
8.3.40.0140.00719.10
8.3.30.0110.00718.96
8.3.20.0080.00018.98
8.3.10.0050.00320.78
8.3.00.0100.00017.88
8.2.180.0030.01616.75
8.2.170.0120.00322.96
8.2.160.0000.01519.08
8.2.150.0030.00624.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00321.13
8.2.110.0000.00920.88
8.2.100.0120.00017.97
8.2.90.0090.00019.44
8.2.80.0040.00419.45
8.2.70.0040.00417.88
8.2.60.0000.00818.16
8.2.50.0030.00618.07
8.2.40.0000.00818.09
8.2.30.0000.00718.15
8.2.20.0050.00518.03
8.2.10.0040.00418.06
8.2.00.0060.00318.05
8.1.280.0120.00625.92
8.1.270.0090.00024.66
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00022.64
8.1.230.0110.00021.10
8.1.220.0060.00317.74
8.1.210.0080.00019.00
8.1.200.0000.00917.48
8.1.190.0050.00217.65
8.1.180.0030.00618.10
8.1.170.0080.00019.03
8.1.160.0000.00918.95
8.1.150.0000.00818.82
8.1.140.0000.00817.69
8.1.130.0030.00317.80
8.1.120.0040.00417.55
8.1.110.0030.00517.64
8.1.100.0000.00717.62
8.1.90.0030.00617.58
8.1.80.0040.00417.55
8.1.70.0040.00417.61
8.1.60.0090.00017.73
8.1.50.0050.00317.61
8.1.40.0000.00817.69
8.1.30.0030.00517.80
8.1.20.0040.00417.76
8.1.10.0050.00317.83
8.1.00.0080.00017.70
8.0.300.0040.00420.16
8.0.290.0070.00017.00
8.0.280.0000.00818.41
8.0.270.0070.00017.26
8.0.260.0070.00017.07
8.0.250.0040.00417.16
8.0.240.0050.00317.25
8.0.230.0040.00417.17
8.0.220.0000.00717.16
8.0.210.0040.00417.02
8.0.200.0000.00717.04
8.0.190.0060.00317.16
8.0.180.0080.00417.16
8.0.170.0000.01017.01
8.0.160.0000.00717.14
8.0.150.0000.00817.10
8.0.140.0030.00617.05
8.0.130.0030.00313.54
8.0.120.0030.00717.13
8.0.110.0000.00817.09
8.0.100.0080.00017.20
8.0.90.0000.00817.10
8.0.80.0040.01517.09
8.0.70.0090.00017.14
8.0.60.0000.00717.10
8.0.50.0040.00417.04
8.0.30.0140.00917.11
8.0.20.0080.01217.31
8.0.10.0000.00817.30
8.0.00.0110.00817.04
7.4.330.0030.00313.26
7.4.320.0030.00316.75
7.4.300.0080.00016.82
7.4.290.0020.00516.76
7.4.280.0040.00416.66
7.4.270.0040.00416.86
7.4.260.0000.00613.50
7.4.250.0030.00616.79
7.4.240.0070.00016.61
7.4.230.0030.00316.68
7.4.220.0160.01016.79
7.4.210.0050.01216.80
7.4.200.0000.00716.86
7.4.190.0050.00316.99
7.4.160.0100.00616.68
7.4.150.0140.00316.76
7.4.140.0070.01016.72
7.4.130.0120.00716.82
7.4.120.0090.00816.78
7.4.110.0120.00616.74
7.4.100.0110.00716.98
7.4.90.0120.00616.58
7.4.80.0080.01119.39
7.4.70.0060.01516.72
7.4.60.0100.01016.71
7.4.50.0000.01216.63
7.4.40.0050.00516.76
7.4.30.0030.02016.60
7.4.00.0070.01015.23
7.3.330.0030.00313.46
7.3.320.0000.00513.57
7.3.310.0080.00016.46
7.3.300.0030.00316.65
7.3.290.0160.00616.61
7.3.280.0040.01616.55
7.3.270.0170.00616.54
7.3.260.0090.00916.59
7.3.250.0100.01216.63
7.3.240.0100.00616.92
7.3.230.0110.00816.79
7.3.210.0030.01316.91
7.3.200.0140.00416.56
7.3.190.0070.01416.71
7.3.180.0040.01216.90
7.3.170.0000.01516.75
7.3.160.0080.00816.71
7.3.120.0050.01215.21
7.3.110.0040.01514.70
7.3.100.0030.00915.11
7.3.90.0030.00615.16
7.3.80.0110.00715.23
7.3.70.0070.00715.01
7.3.60.0030.00715.18
7.3.50.0090.00615.13
7.3.40.0040.00715.18
7.3.30.0070.00415.25
7.3.20.0060.00916.97
7.3.10.0090.00616.87
7.3.00.0100.00616.71
7.2.330.0090.00916.96
7.2.320.0080.01616.68
7.2.310.0090.00916.86
7.2.300.0030.01916.91
7.2.290.0040.01416.78
7.2.250.0060.00915.07
7.2.240.0030.01615.11
7.2.230.0130.00315.30
7.2.220.0090.00615.38
7.2.210.0110.00315.20
7.2.200.0000.01215.19
7.2.190.0130.00315.25
7.2.180.0130.00015.17
7.2.170.0060.00615.27
7.2.60.0130.00416.79
7.2.50.0220.00317.11
7.1.330.0000.01515.99
7.1.320.0040.01415.84
7.1.310.0040.01115.86
7.1.300.0100.00615.90
7.1.290.0030.00915.92
7.1.280.0060.00616.06
7.1.270.0000.01216.04
7.1.260.0070.00716.25
7.1.200.0090.00316.03
7.1.70.0000.00917.37
7.1.60.0160.01019.40
7.1.50.0040.00816.93
7.1.00.0000.06022.44
7.0.200.0400.00314.99
7.0.140.0000.07721.95
7.0.120.0000.04022.05
7.0.60.0130.07020.02
7.0.50.0070.08717.91
7.0.40.0100.04717.73
7.0.30.0100.05317.75
7.0.20.0100.08317.80
7.0.10.0030.05017.77
7.0.00.0070.08317.82
5.6.280.0030.07021.03
5.6.210.0030.07320.58
5.6.200.0070.08718.29
5.6.190.0130.07718.16
5.6.180.0070.04718.21
5.6.170.0100.08018.16
5.6.160.0030.04318.20
5.6.150.0130.04018.15
5.6.140.0030.05018.18
5.6.130.0070.04018.18
5.6.120.0000.05018.28
5.6.110.0000.08718.14
5.6.100.0130.03718.17
5.6.90.0000.06718.12
5.6.80.0130.03317.57
5.6.70.0130.07317.55
5.6.60.0030.05717.59
5.6.50.0030.07317.62
5.6.40.0170.06717.63
5.6.30.0070.05717.49
5.6.20.0070.05717.55
5.6.10.0030.04717.60
5.6.00.0170.06717.58
5.5.350.0270.08020.48
5.5.340.0100.04318.00
5.5.330.0070.08318.04
5.5.320.0000.07017.96
5.5.310.0030.08317.97
5.5.300.0070.04718.04
5.5.290.0030.07718.06
5.5.280.0000.05017.94
5.5.270.0070.08317.95
5.5.260.0070.05317.93
5.5.250.0070.08017.89
5.5.240.0000.05017.41
5.5.230.0070.05317.43
5.5.220.0030.05317.31
5.5.210.0100.06317.36
5.5.200.0070.05017.46
5.5.190.0030.04017.31
5.5.180.0030.05717.32
5.5.160.0030.05717.35
5.5.150.0070.06317.28
5.5.140.0070.07717.32
5.5.130.0070.06017.38
5.5.120.0100.06317.37
5.5.110.0070.06017.32
5.5.100.0070.06717.26
5.5.90.0070.07717.23
5.5.80.0100.07317.32
5.5.70.0100.07317.18
5.5.60.0130.06317.27
5.5.50.0030.07717.25
5.5.40.0100.04317.28
5.5.30.0100.05317.28
5.5.20.0070.05317.22
5.5.10.0030.04017.24
5.5.00.0100.07717.17
5.4.450.0070.07319.31
5.4.440.0070.06019.21
5.4.430.0030.05319.37
5.4.420.0130.06319.20
5.4.410.0070.07719.21
5.4.400.0000.07318.95
5.4.390.0070.05718.98
5.4.380.0100.06719.04
5.4.370.0030.06719.11
5.4.360.0170.06318.88
5.4.350.0170.03319.05
5.4.340.0070.04719.11
5.4.320.0070.07719.09
5.4.310.0130.06719.30
5.4.300.0100.05719.09
5.4.290.0030.05318.95
5.4.280.0100.07019.03
5.4.270.0000.05719.02
5.4.260.0130.05319.05
5.4.250.0030.06719.04
5.4.240.0000.08019.09
5.4.230.0070.08019.12
5.4.220.0070.05719.11
5.4.210.0030.08319.01
5.4.200.0130.04318.94
5.4.190.0000.08719.25
5.4.180.0130.03718.89
5.4.170.0070.05019.08
5.4.160.0070.07719.01
5.4.150.0070.06019.11
5.4.140.0030.06316.45
5.4.130.0030.04316.46
5.4.120.0130.07016.59
5.4.110.0070.06016.34
5.4.100.0200.06016.45
5.4.90.0170.06716.47
5.4.80.0070.07016.33
5.4.70.0100.07016.38
5.4.60.0100.07316.55
5.4.50.0000.05016.30
5.4.40.0000.05716.41
5.4.30.0100.06016.37
5.4.20.0070.05016.40
5.4.10.0170.06316.45
5.4.00.0030.04715.74
5.3.290.0070.06014.73
5.3.280.0000.06314.67
5.3.270.0130.05014.71
5.3.260.0130.05014.84
5.3.250.0070.07014.66
5.3.240.0130.03014.70
5.3.230.0030.04314.47
5.3.220.0030.06314.57
5.3.210.0070.07714.61
5.3.200.0070.04014.59
5.3.190.0170.06014.69
5.3.180.0100.05314.62
5.3.170.0070.07314.62
5.3.160.0030.07714.61
5.3.150.0100.07014.59
5.3.140.0100.07014.60
5.3.130.0000.05314.64
5.3.120.0130.07014.58
5.3.110.0070.07314.57
5.3.100.0100.06314.09
5.3.90.0070.07714.25
5.3.80.0000.04714.06
5.3.70.0000.08314.05
5.3.60.0100.03714.06
5.3.50.0070.03714.01
5.3.40.0070.04013.98
5.3.30.0030.06313.94
5.3.20.0000.04313.79
5.3.10.0100.07313.70
5.3.00.0070.04013.67
5.2.170.0030.03011.16
5.2.160.0030.03011.15
5.2.150.0070.05011.38
5.2.140.0000.04011.26
5.2.130.0100.05311.01
5.2.120.0070.03011.11
5.2.110.0070.04011.12
5.2.100.0000.03311.02
5.2.90.0100.03311.08
5.2.80.0000.03711.02
5.2.70.0070.06011.01
5.2.60.0170.03711.12
5.2.50.0000.06311.04
5.2.40.0070.05010.94
5.2.30.0030.05311.06
5.2.20.0000.06311.04
5.2.10.0100.04010.93
5.2.00.0000.03010.70
5.1.60.0030.04710.00
5.1.50.0000.0309.97
5.1.40.0030.05710.09
5.1.30.0030.05710.37
5.1.20.0070.05010.41
5.1.10.0030.06010.06
5.1.00.0100.04010.16
5.0.50.0000.0338.57
5.0.40.0000.0508.48
5.0.30.0000.0708.20
5.0.20.0030.0438.26
5.0.10.0000.0308.18
5.0.00.0030.0638.25
4.4.90.0070.0377.58
4.4.80.0000.0377.58
4.4.70.0000.0407.58
4.4.60.0030.0277.58
4.4.50.0030.0377.58
4.4.40.0000.0437.58
4.4.30.0030.0377.58
4.4.20.0070.0277.58
4.4.10.0030.0177.58
4.4.00.0030.0337.58
4.3.110.0000.0177.58
4.3.100.0000.0277.58
4.3.90.0070.0207.58
4.3.80.0000.0537.58
4.3.70.0000.0377.58
4.3.60.0030.0377.58
4.3.50.0030.0237.58
4.3.40.0030.0537.58
4.3.30.0030.0277.58
4.3.20.0030.0207.58
4.3.10.0000.0337.58
4.3.00.0000.0377.58

preferences:
41.71 ms | 401 KiB | 5 Q