3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n = '1,512,523'; 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.0040.01818.28
8.3.50.0140.00921.14
8.3.40.0080.01118.96
8.3.30.0140.00020.34
8.3.20.0080.00020.09
8.3.10.0030.00521.22
8.3.00.0030.00622.37
8.2.180.0160.00016.88
8.2.170.0040.01222.96
8.2.160.0160.00320.96
8.2.150.0100.00624.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00020.91
8.2.110.0060.00320.56
8.2.100.0040.00817.91
8.2.90.0050.00519.17
8.2.80.0040.00417.97
8.2.70.0050.00517.75
8.2.60.0000.00818.03
8.2.50.0000.00818.10
8.2.40.0060.00320.65
8.2.30.0050.00319.44
8.2.20.0020.00517.91
8.2.10.0040.00417.81
8.2.00.0030.00517.84
8.1.280.0110.00425.92
8.1.270.0040.00424.66
8.1.260.0080.00826.35
8.1.250.0000.00728.09
8.1.240.0040.00423.83
8.1.230.0070.00417.95
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0080.00317.48
8.1.190.0030.00617.48
8.1.180.0000.00818.10
8.1.170.0030.00618.90
8.1.160.0040.00422.20
8.1.150.0040.00418.82
8.1.140.0040.00417.67
8.1.130.0000.00717.74
8.1.120.0040.00417.67
8.1.110.0000.00717.63
8.1.100.0040.00417.71
8.1.90.0040.00417.59
8.1.80.0050.00317.56
8.1.70.0040.00417.59
8.1.60.0040.00417.70
8.1.50.0050.00217.62
8.1.40.0000.00817.66
8.1.30.0040.00417.87
8.1.20.0050.00317.69
8.1.10.0000.00717.81
8.1.00.0000.00817.71
8.0.300.0000.00818.77
8.0.290.0000.00917.00
8.0.280.0030.00318.55
8.0.270.0000.00717.25
8.0.260.0000.00717.00
8.0.250.0000.00717.04
8.0.240.0040.00417.05
8.0.230.0000.00717.07
8.0.220.0040.00416.98
8.0.210.0070.00016.90
8.0.200.0040.00417.04
8.0.190.0080.00017.09
8.0.180.0000.00716.98
8.0.170.0040.00417.04
8.0.160.0040.00416.88
8.0.150.0040.00416.93
8.0.140.0060.00616.92
8.0.130.0030.00313.50
8.0.120.0040.00417.01
8.0.110.0040.00416.98
8.0.100.0040.00417.09
8.0.90.0000.00817.06
8.0.80.0030.01217.00
8.0.70.0040.00417.04
8.0.60.0020.00516.91
8.0.50.0000.00817.18
8.0.30.0090.00917.04
8.0.20.0140.00617.40
8.0.10.0050.00317.06
8.0.00.0090.00916.88
7.4.330.0000.00516.68
7.4.320.0000.00716.85
7.4.300.0060.00316.75
7.4.290.0000.00716.87
7.4.280.0040.00416.82
7.4.270.0070.00016.66
7.4.260.0000.00613.41
7.4.250.0000.00816.85
7.4.240.0030.00516.81
7.4.230.0050.00216.89
7.4.220.0090.00916.77
7.4.210.0080.00516.82
7.4.200.0080.00016.88
7.4.190.0000.00816.89
7.4.160.0090.00616.70
7.4.150.0070.01017.40
7.4.140.0090.00817.86
7.4.130.0090.00816.80
7.4.120.0130.00616.69
7.4.110.0060.01116.75
7.4.100.0070.01016.84
7.4.90.0120.00616.80
7.4.80.0070.01019.39
7.4.70.0100.00716.74
7.4.60.0100.00716.72
7.4.50.0040.00416.59
7.4.40.0060.00922.77
7.4.30.0090.00916.67
7.4.00.0040.01214.95
7.3.330.0030.00313.37
7.3.320.0030.00313.56
7.3.310.0070.00016.65
7.3.300.0040.00416.55
7.3.290.0030.01016.57
7.3.280.0040.01316.55
7.3.270.0000.01717.40
7.3.260.0150.00918.24
7.3.250.0070.01016.66
7.3.240.0030.01316.60
7.3.230.0120.00616.57
7.3.210.0080.00816.61
7.3.200.0090.00919.39
7.3.190.0070.01016.61
7.3.180.0100.00716.57
7.3.170.0090.00916.49
7.3.160.0180.00016.89
7.3.120.0090.00615.08
7.3.10.0060.00916.64
7.3.00.0040.00716.80
7.2.330.0140.00416.80
7.2.320.0030.01516.71
7.2.310.0140.00716.87
7.2.300.0030.01317.02
7.2.290.0100.00716.80
7.2.130.0040.01117.09
7.2.120.0030.01317.17
7.2.110.0040.01117.07
7.2.100.0060.00617.23
7.2.90.0070.00717.01
7.2.80.0180.00317.04
7.2.70.0070.01017.10
7.2.60.0140.00717.10
7.2.50.0070.01017.17
7.2.40.0160.00017.05
7.2.30.0060.00917.13
7.2.20.0100.00717.21
7.2.10.0060.01016.91
7.2.00.0070.00518.45
7.1.250.0050.00315.69
7.1.240.0130.00315.95
7.1.230.0180.00016.11
7.1.220.0150.00415.94
7.1.210.0060.00916.05
7.1.200.0000.01216.16
7.1.190.0090.00315.86
7.1.180.0070.00715.91
7.1.170.0110.01116.07
7.1.160.0000.01316.12
7.1.150.0100.00316.04
7.1.140.0060.00315.92
7.1.130.0160.00315.55
7.1.120.0060.01015.73
7.1.110.0090.00915.95
7.1.100.0030.01017.28
7.1.90.0140.00016.11
7.1.80.0060.01016.16
7.1.70.0050.00816.56
7.1.60.0110.00917.55
7.1.50.0100.00816.44
7.1.40.0040.01216.03
7.1.30.0030.00715.92
7.1.20.0000.01415.74
7.1.10.0070.00715.99
7.1.00.0030.04019.08
7.0.330.0130.00315.57
7.0.320.0040.01215.59
7.0.310.0040.00815.55
7.0.300.0070.01115.80
7.0.290.0120.00615.69
7.0.280.0090.00315.62
7.0.270.0070.01015.49
7.0.260.0090.00615.38
7.0.250.0040.00915.80
7.0.240.0060.00315.52
7.0.230.0000.00915.68
7.0.220.0160.00315.69
7.0.210.0060.00315.68
7.0.200.0000.00916.47
7.0.190.0070.01015.74
7.0.180.0050.00515.40
7.0.170.0080.01015.59
7.0.160.0060.00315.73
7.0.150.0090.00615.39
7.0.140.0040.04218.76
7.0.130.0070.00715.70
7.0.120.0100.00615.38
7.0.110.0050.02817.81
7.0.100.0120.04517.78
7.0.90.0070.04417.74
7.0.80.0020.04417.68
7.0.70.0110.03717.65
7.0.60.0030.04817.86
7.0.50.0050.04917.89
7.0.40.0080.04316.65
7.0.30.0050.04416.72
7.0.20.0030.03016.56
7.0.10.0070.04216.60
7.0.00.0070.04416.66
5.6.380.0040.01114.66
5.6.370.0030.00914.64
5.6.360.0060.00914.72
5.6.350.0080.00814.78
5.6.340.0110.00414.28
5.6.330.0110.00414.45
5.6.320.0060.00914.73
5.6.310.0070.01014.24
5.6.300.0080.00514.45
5.6.290.0050.00914.44
5.6.280.0060.04317.86
5.6.270.0040.01514.67
5.6.260.0090.04317.53
5.6.250.0070.04417.53
5.6.240.0070.04717.42
5.6.230.0060.04517.62
5.6.220.0080.04617.45
5.6.210.0060.03517.52
5.6.200.0080.03317.46
5.6.190.0050.04717.66
5.6.180.0000.03317.67
5.6.170.0060.02617.40
5.6.160.0080.02617.66
5.6.150.0050.04817.45
5.6.140.0070.04317.55
5.6.130.0080.04017.33
5.6.120.0120.03817.73
5.6.110.0130.03817.70
5.6.100.0100.04217.39
5.6.90.0030.04417.44
5.6.80.0090.03817.28
5.6.70.0080.03517.23
5.6.60.0090.04017.30
5.6.50.0070.04317.24
5.6.40.0030.04617.19
5.6.30.0120.03717.18
5.6.20.0000.04817.16
5.6.10.0110.03817.05
5.6.00.0070.02417.26
5.5.380.0110.04415.89
5.5.370.0110.03815.81
5.5.360.0050.04615.63
5.5.350.0090.04115.76
5.5.340.0030.04516.28
5.5.330.0080.04316.02
5.5.320.0100.03415.91
5.5.310.0100.03515.99
5.5.300.0150.03216.03
5.5.290.0050.04216.20
5.5.280.0150.03716.06
5.5.270.0080.02716.04
5.5.260.0000.04916.14
5.5.250.0090.04315.94
5.5.240.0110.03815.86
5.5.230.0100.02515.77
5.5.220.0070.04015.77
5.5.210.0080.04015.81
5.5.200.0040.04815.74
5.5.190.0100.04215.87
5.5.180.0090.03915.68
5.5.170.0060.00611.30
5.5.160.0060.04315.84
5.5.150.0090.02315.63
5.5.140.0030.04315.82
5.5.130.0060.04315.62
5.5.120.0070.04015.77
5.5.110.0030.04515.77
5.5.100.0110.03315.65
5.5.90.0060.03815.64
5.5.80.0030.04115.52
5.5.70.0080.03615.47
5.5.60.0150.03315.67
5.5.50.0090.03615.76
5.5.40.0090.03715.65
5.5.30.0050.04415.71
5.5.20.0070.03715.74
5.5.10.0030.02815.74
5.5.00.0020.03015.68
5.4.450.0120.04015.19
5.4.440.0100.04015.37
5.4.430.0040.03215.25
5.4.420.0020.04515.38
5.4.410.0030.04815.32
5.4.400.0040.04615.08
5.4.390.0040.04414.95
5.4.380.0050.04514.98
5.4.370.0030.04315.00
5.4.360.0080.03815.21
5.4.350.0050.03915.08
5.4.340.0030.02814.98
5.4.330.0030.00311.11
5.4.320.0050.04215.12
5.4.310.0080.03615.03
5.4.300.0060.04015.19
5.4.290.0070.02515.17
5.4.280.0080.03714.98
5.4.270.0050.04115.20
5.4.260.0120.03614.98
5.4.250.0080.03814.97
5.4.240.0030.03615.07
5.4.230.0080.03715.09
5.4.220.0060.03915.16
5.4.210.0070.03615.21
5.4.200.0040.02915.14
5.4.190.0070.04214.99
5.4.180.0100.03815.10
5.4.170.0080.03114.85
5.4.160.0130.03315.11
5.4.150.0050.04114.99
5.4.140.0090.03913.59
5.4.130.0040.03313.95
5.4.120.0020.02713.75
5.4.110.0050.04013.82
5.4.100.0050.04113.86
5.4.90.0050.03913.72
5.4.80.0050.02013.76
5.4.70.0050.02113.78
5.4.60.0030.03813.95
5.4.50.0070.02013.89
5.4.40.0050.02413.94
5.4.30.0070.01813.95
5.4.20.0060.02013.86
5.4.10.0050.02313.85
5.4.00.0030.02013.64
5.3.290.0050.04312.61
5.3.280.0030.03012.69
5.3.270.0070.03212.54
5.3.260.0030.04612.63
5.3.250.0030.02512.77
5.3.240.0040.04112.61
5.3.230.0050.03612.60
5.3.220.0070.03712.60
5.3.210.0090.03812.61
5.3.200.0080.02312.61
5.3.190.0070.02812.56
5.3.180.0030.02212.74
5.3.170.0030.02812.67
5.3.160.0030.02312.80
5.3.150.0000.02312.78
5.3.140.0070.03412.53
5.3.130.0030.02612.64
5.3.120.0000.02312.68
5.3.110.0070.02012.53
5.3.100.0030.02512.24
5.3.90.0020.03612.30
5.3.80.0050.01812.32
5.3.70.0040.02412.31
5.3.60.0030.02312.42
5.3.50.0050.02512.40
5.3.40.0040.02112.35
5.3.30.0070.03312.32
5.3.20.0060.01912.06
5.3.10.0000.02112.10
5.3.00.0050.02411.91
5.2.170.0020.02510.90
5.2.160.0020.01910.90
5.2.150.0020.01710.90
5.2.140.0030.01510.90
5.2.130.0030.01810.90
5.2.120.0030.02010.90
5.2.110.0060.01510.90
5.2.100.0060.01310.90
5.2.90.0030.01710.90
5.2.80.0030.02810.90
5.2.70.0020.02710.90
5.2.60.0050.02510.90
5.2.50.0050.02710.90
5.2.40.0010.02110.90
5.2.30.0000.01910.90
5.2.20.0020.01310.90
5.2.10.0050.03010.90
5.2.00.0010.01610.90
5.1.60.0070.01010.90
5.1.50.0020.01710.90
5.1.40.0030.01510.90
5.1.30.0030.01810.90
5.1.20.0050.01310.90
5.1.10.0030.01610.90
5.1.00.0080.01310.90
5.0.50.0030.01310.90
5.0.40.0020.01310.90
5.0.30.0020.01710.90
5.0.20.0030.01510.90
5.0.10.0040.01210.90
5.0.00.0000.01910.90
4.4.90.0030.00710.90
4.4.80.0000.01410.90
4.4.70.0020.01010.90
4.4.60.0030.00910.90
4.4.50.0020.01310.90
4.4.40.0040.01310.90
4.4.30.0000.01410.90
4.4.20.0020.00810.90
4.4.10.0000.01010.90
4.4.00.0010.01310.90
4.3.110.0020.00810.90
4.3.100.0000.00910.90
4.3.90.0020.00710.90
4.3.80.0030.01210.90
4.3.70.0020.00710.90
4.3.60.0020.00810.90
4.3.50.0000.01110.90
4.3.40.0000.02010.90
4.3.30.0000.01510.90
4.3.20.0000.01110.90
4.3.10.0020.01010.90
4.3.00.0010.01010.90

preferences:
44.74 ms | 401 KiB | 5 Q