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; } 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.0070.01018.30
8.3.50.0100.00721.26
8.3.40.0090.00618.96
8.3.30.0030.01320.20
8.3.20.0040.00420.36
8.3.10.0040.00420.97
8.3.00.0080.00022.33
8.2.180.0180.00418.23
8.2.170.0110.00422.96
8.2.160.0070.00722.34
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00726.16
8.2.120.0030.00620.98
8.2.110.0030.00619.45
8.2.100.0110.00017.91
8.2.90.0050.00319.26
8.2.80.0050.00318.05
8.2.70.0060.00317.50
8.2.60.0000.00818.05
8.2.50.0080.00018.07
8.2.40.0000.01018.21
8.2.30.0040.00419.43
8.2.20.0000.00817.96
8.2.10.0000.00717.84
8.2.00.0040.00417.99
8.1.280.0120.00625.92
8.1.270.0030.00523.99
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0000.01023.80
8.1.230.0080.00321.01
8.1.220.0050.00318.77
8.1.210.0000.00820.88
8.1.200.0030.00617.60
8.1.190.0040.00417.75
8.1.180.0040.00418.10
8.1.170.0060.00318.76
8.1.160.0080.00018.95
8.1.150.0050.00218.85
8.1.140.0000.00917.63
8.1.130.0030.00317.79
8.1.120.0000.00717.55
8.1.110.0040.00417.53
8.1.100.0000.00717.69
8.1.90.0030.00517.66
8.1.80.0000.00717.66
8.1.70.0000.00717.63
8.1.60.0040.00417.65
8.1.50.0040.00417.61
8.1.40.0040.00417.65
8.1.30.0040.00417.72
8.1.20.0000.00817.82
8.1.10.0000.00817.77
8.1.00.0040.00417.66
8.0.300.0070.00020.15
8.0.290.0000.00717.28
8.0.280.0000.00718.57
8.0.270.0030.00317.36
8.0.260.0030.00317.11
8.0.250.0000.00717.15
8.0.240.0060.00317.13
8.0.230.0000.00817.15
8.0.220.0030.00316.95
8.0.210.0030.00317.04
8.0.200.0000.00717.02
8.0.190.0040.00417.10
8.0.180.0050.00217.06
8.0.170.0070.00017.08
8.0.160.0070.00017.00
8.0.150.0040.00417.10
8.0.140.0030.00616.86
8.0.130.0000.00613.43
8.0.120.0050.00317.13
8.0.110.0100.00016.98
8.0.100.0070.00017.07
8.0.90.0000.00816.94
8.0.80.0040.01217.07
8.0.70.0040.00416.94
8.0.60.0000.00717.06
8.0.50.0040.00417.00
8.0.30.0110.01017.39
8.0.20.0080.01017.40
8.0.10.0040.00417.21
8.0.00.0100.00816.93
7.4.330.0000.00616.79
7.4.320.0000.00716.73
7.4.300.0050.00316.85
7.4.290.0000.00716.82
7.4.280.0030.00316.66
7.4.270.0070.00016.74
7.4.260.0000.00613.50
7.4.250.0040.00416.70
7.4.240.0020.00516.83
7.4.230.0000.00816.73
7.4.220.0100.00716.70
7.4.210.0100.00716.88
7.4.200.0000.00716.80
7.4.190.0000.00716.72
7.4.160.0150.00616.73
7.4.150.0050.01417.40
7.4.140.0110.00717.86
7.4.130.0080.01116.79
7.4.120.0140.00316.74
7.4.110.0130.01016.79
7.4.100.0060.01616.65
7.4.90.0130.00716.79
7.4.80.0030.01419.39
7.4.70.0070.01416.77
7.4.60.0040.01116.58
7.4.50.0060.00316.84
7.4.40.0100.00322.77
7.4.30.0100.00716.63
7.4.00.0080.00815.27
7.3.330.0000.00513.49
7.3.320.0030.00313.61
7.3.310.0030.00316.44
7.3.300.0030.00316.38
7.3.290.0070.00716.56
7.3.280.0070.01016.56
7.3.270.0100.00717.40
7.3.260.0100.01318.24
7.3.250.0060.01016.67
7.3.240.0130.00316.79
7.3.230.0000.01616.91
7.3.210.0090.00816.80
7.3.200.0090.00919.39
7.3.190.0140.00616.84
7.3.180.0070.01316.91
7.3.170.0080.01516.90
7.3.160.0130.00716.86
7.3.120.0090.00714.92
7.3.110.0120.00614.88
7.3.100.0030.00914.71
7.3.90.0100.00615.20
7.3.80.0070.01015.05
7.3.70.0100.00615.23
7.3.60.0120.00415.13
7.3.50.0080.00014.97
7.3.40.0000.01315.09
7.3.30.0000.01715.00
7.3.20.0090.00616.96
7.3.10.0080.00616.76
7.3.00.0050.00816.80
7.2.330.0070.01016.70
7.2.320.0070.01316.88
7.2.310.0180.00316.62
7.2.300.0000.02116.83
7.2.290.0090.00917.06
7.2.250.0070.01315.35
7.2.240.0070.01315.12
7.2.230.0030.01815.22
7.2.220.0070.00715.05
7.2.210.0060.00615.34
7.2.200.0090.00615.33
7.2.190.0100.00315.37
7.2.180.0000.01314.94
7.2.170.0000.00915.04
7.2.130.0090.00617.24
7.2.120.0060.00917.13
7.2.110.0070.00416.81
7.2.100.0030.01317.07
7.2.90.0070.00316.86
7.2.80.0000.01217.09
7.2.70.0060.00617.05
7.2.60.0070.00717.19
7.2.50.0070.00416.80
7.2.40.0070.01017.32
7.2.30.0030.01417.14
7.2.20.0110.00017.10
7.2.10.0030.01316.87
7.2.00.0080.00718.45
7.1.330.0090.00616.19
7.1.320.0000.01216.05
7.1.310.0120.00016.15
7.1.300.0030.00715.99
7.1.290.0040.00716.01
7.1.280.0040.00416.01
7.1.270.0060.00315.72
7.1.260.0040.00715.72
7.1.250.0100.00715.97
7.1.100.0000.00918.43
7.1.70.0040.01117.34
7.1.60.0060.01919.17
7.1.50.0160.00916.86
7.1.00.0100.06022.46
7.0.200.0020.00517.09
7.0.140.0000.07721.91
7.0.100.0030.06320.08
7.0.90.0170.07019.88
7.0.80.0000.05319.96
7.0.70.0430.08319.90
7.0.60.0070.08319.98
7.0.50.0130.06320.29
7.0.40.0070.05720.03
7.0.30.0070.05720.18
7.0.20.0100.08720.17
7.0.10.0130.06320.03
7.0.00.0070.08320.04
5.6.280.0000.07721.09
5.6.250.0030.08320.61
5.6.240.0030.09020.59
5.6.230.0130.07720.61
5.6.220.0030.09020.57
5.6.210.0170.05320.70
5.6.200.0230.03321.09
5.6.190.0100.08721.09
5.6.180.0100.08321.09
5.6.170.0030.08321.18
5.6.160.0100.07721.12
5.6.150.0030.08021.04
5.6.140.0030.08021.12
5.6.130.0030.08721.04
5.6.120.0070.07721.03
5.6.110.0100.04720.95
5.6.100.0070.07021.05
5.6.90.0200.06321.02
5.6.80.0070.06320.56
5.6.70.0100.04320.33
5.6.60.0100.03320.33
5.6.50.0030.04020.51
5.6.40.0030.06720.41
5.6.30.0070.03720.43
5.6.20.0100.07320.32
5.6.10.0030.04320.41
5.6.00.0100.05320.39
5.5.380.0100.06020.46
5.5.370.0130.07720.38
5.5.360.0200.07320.32
5.5.350.0100.06020.46
5.5.340.0100.08320.92
5.5.330.0100.08020.81
5.5.320.0170.07320.95
5.5.310.0030.08720.81
5.5.300.0130.06020.90
5.5.290.0030.04720.89
5.5.280.0100.07720.75
5.5.270.0030.04720.80
5.5.260.0070.08020.77
5.5.250.0070.08020.62
5.5.240.0070.04720.21
5.5.230.0070.04020.16
5.5.220.0070.04020.27
5.5.210.0000.04320.26
5.5.200.0030.08320.27
5.5.190.0100.06020.09
5.5.180.0130.06720.20
5.5.160.0100.08320.09
5.5.150.0030.04720.16
5.5.140.0100.08020.17
5.5.130.0170.07020.25
5.5.120.0030.05320.19
5.5.110.0030.05020.22
5.5.100.0100.07320.02
5.5.90.0070.07320.16
5.5.80.0100.07320.12
5.5.70.0030.07320.07
5.5.60.0130.07320.01
5.5.50.0030.07320.04
5.5.40.0070.07720.07
5.5.30.0130.04320.15
5.5.20.0070.07320.07
5.5.10.0070.04020.09
5.5.00.0030.07720.02
5.4.450.0130.07319.38
5.4.440.0170.06719.50
5.4.430.0100.07319.45
5.4.420.0030.05719.35
5.4.410.0070.08319.22
5.4.400.0100.07018.91
5.4.390.0070.03318.86
5.4.380.0030.06319.16
5.4.370.0070.07719.04
5.4.360.0030.03719.04
5.4.350.0100.04318.88
5.4.340.0030.06719.21
5.4.320.0130.06718.90
5.4.310.0070.05018.95
5.4.300.0070.07319.03
5.4.290.0030.07319.12
5.4.280.0070.06319.04
5.4.270.0130.07019.15
5.4.260.0170.05319.02
5.4.250.0030.07018.89
5.4.240.0130.05019.13
5.4.230.0100.05019.09
5.4.220.0030.07719.02
5.4.210.0100.07319.02
5.4.200.0070.06719.17
5.4.190.0170.05019.02
5.4.180.0100.06319.08
5.4.170.0130.03719.04
5.4.160.0070.03719.14
5.4.150.0070.06318.83
5.4.140.0070.07316.36
5.4.130.0130.04716.35
5.4.120.0130.07016.36
5.4.110.0070.04016.39
5.4.100.0030.08016.36
5.4.90.0100.04016.45
5.4.80.0100.04016.51
5.4.70.0030.04316.41
5.4.60.0000.05016.42
5.4.50.0030.06316.40
5.4.40.0070.06716.46
5.4.30.0000.08316.25
5.4.20.0030.04716.44
5.4.10.0100.04316.33
5.4.00.0030.04315.83
5.3.290.0030.08314.75
5.3.280.0000.08314.70
5.3.270.0030.06014.73
5.3.260.0130.06714.61
5.3.250.0030.04714.74
5.3.240.0100.06714.61
5.3.230.0170.07714.63
5.3.220.0000.05714.56
5.3.210.0070.07314.68
5.3.200.0000.08714.60
5.3.190.0070.05014.52
5.3.180.0000.06314.63
5.3.170.0100.07314.50
5.3.160.0170.06014.70
5.3.150.0100.04014.64
5.3.140.0070.03314.67
5.3.130.0030.05014.63
5.3.120.0100.04714.59
5.3.110.0170.06314.58
5.3.100.0030.08013.98
5.3.90.0000.05713.96
5.3.80.0070.05714.05
5.3.70.0070.04014.16
5.3.60.0070.06314.04
5.3.50.0030.07714.11
5.3.40.0030.05314.02
5.3.30.0100.04713.97
5.3.20.0030.06013.63
5.3.10.0100.04713.69
5.3.00.0000.04713.76
5.2.170.0030.04312.36
5.2.160.0130.05712.36
5.2.150.0100.05012.36
5.2.140.0000.06312.36
5.2.130.0000.06012.36
5.2.120.0030.06312.36
5.2.110.0000.03012.36
5.2.100.0070.02712.36
5.2.90.0030.03012.36
5.2.80.0070.05312.36
5.2.70.0100.04712.36
5.2.60.0030.03312.36
5.2.50.0030.05012.36
5.2.40.0030.06312.36
5.2.30.0100.04312.36
5.2.20.0070.04012.36
5.2.10.0030.02712.36
5.2.00.0030.03312.36
5.1.60.0000.02712.36
5.1.50.0030.02312.36
5.1.40.0100.01712.36
5.1.30.0000.02712.36
5.1.20.0000.03012.36
5.1.10.0000.02712.36
5.1.00.0100.02012.36
5.0.50.0030.02012.36
5.0.40.0000.02012.36
5.0.30.0000.03012.36
5.0.20.0030.02012.36
5.0.10.0070.01312.36
5.0.00.0030.03012.36
4.4.90.0030.03312.36
4.4.80.0030.03712.36
4.4.70.0000.02012.36
4.4.60.0070.01312.36
4.4.50.0000.01712.36
4.4.40.0030.02012.36
4.4.30.0000.01712.36
4.4.20.0000.01312.36
4.4.10.0030.01312.36
4.4.00.0000.02312.36
4.3.110.0000.01712.36
4.3.100.0000.01712.36
4.3.90.0000.01712.36
4.3.80.0000.02312.36
4.3.70.0070.01012.36
4.3.60.0000.01712.36
4.3.50.0000.01712.36
4.3.40.0000.02012.36
4.3.30.0000.01312.36
4.3.20.0000.01712.36
4.3.10.0000.01712.36
4.3.00.0000.01312.36

preferences:
36.05 ms | 401 KiB | 5 Q