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.40.0100.01019.10
8.3.30.0060.00920.26
8.3.20.0040.00420.09
8.3.10.0080.00021.05
8.3.00.0030.00622.25
8.2.170.0120.00322.96
8.2.160.0070.00722.30
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00820.75
8.2.110.0060.00319.27
8.2.100.0080.00417.97
8.2.90.0030.00619.10
8.2.80.0040.00418.05
8.2.70.0050.00517.75
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0030.00618.34
8.2.30.0000.00719.48
8.2.20.0040.00417.98
8.2.10.0040.00417.93
8.2.00.0000.00817.85
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.97
8.1.230.0070.00721.04
8.1.220.0050.00318.77
8.1.210.0000.00820.48
8.1.200.0040.00817.60
8.1.190.0000.00817.63
8.1.180.0000.00918.10
8.1.170.0090.00018.84
8.1.160.0040.00418.82
8.1.150.0040.00418.74
8.1.140.0040.00417.62
8.1.130.0030.00317.80
8.1.120.0000.00717.61
8.1.110.0080.00017.53
8.1.100.0050.00317.65
8.1.90.0050.00217.72
8.1.80.0050.00217.69
8.1.70.0000.00717.65
8.1.60.0030.00517.67
8.1.50.0040.00417.66
8.1.40.0000.00817.72
8.1.30.0000.00817.83
8.1.20.0040.00417.87
8.1.10.0030.00617.74
8.1.00.0040.00417.71
8.0.300.0040.00420.10
8.0.290.0040.00417.30
8.0.280.0000.00718.50
8.0.270.0000.00717.23
8.0.260.0000.00717.04
8.0.250.0030.00317.14
8.0.240.0030.00517.08
8.0.230.0000.00917.09
8.0.220.0030.00417.02
8.0.210.0000.00816.96
8.0.200.0080.00017.10
8.0.190.0000.00817.09
8.0.180.0000.00717.05
8.0.170.0040.00417.14
8.0.160.0000.00717.13
8.0.150.0040.00416.95
8.0.140.0050.00516.96
8.0.130.0030.00313.45
8.0.120.0040.00417.11
8.0.110.0070.00017.09
8.0.100.0080.00017.02
8.0.90.0000.00717.02
8.0.80.0090.00616.99
8.0.70.0080.00017.06
8.0.60.0000.00817.07
8.0.50.0000.00816.85
8.0.30.0100.00817.26
8.0.20.0120.00717.48
8.0.10.0040.00417.01
8.0.00.0150.00516.90
7.4.330.0020.00216.81
7.4.320.0040.00416.64
7.4.300.0050.00516.89
7.4.290.0080.00016.79
7.4.280.0040.00416.64
7.4.270.0040.00416.77
7.4.260.0000.00513.52
7.4.250.0000.00716.81
7.4.240.0050.00216.77
7.4.230.0000.00716.88
7.4.220.0090.01216.86
7.4.210.0070.00816.80
7.4.200.0040.00416.64
7.4.190.0050.00316.90
7.4.160.0060.00916.66
7.4.150.0140.00317.40
7.4.140.0140.02217.86
7.4.130.0050.01216.73
7.4.120.0060.01116.75
7.4.110.0090.00916.74
7.4.100.0120.00616.66
7.4.90.0030.01516.88
7.4.80.0070.01019.39
7.4.70.0120.00616.68
7.4.60.0200.03216.83
7.4.50.0000.00816.82
7.4.40.0120.00022.77
7.4.30.0070.01016.58
7.4.00.0060.00914.94
7.3.330.0000.00613.50
7.3.320.0000.00613.53
7.3.310.0000.00716.51
7.3.300.0040.00416.60
7.3.290.0120.00316.49
7.3.280.0100.01016.52
7.3.270.0120.00617.40
7.3.260.0180.00018.24
7.3.250.0130.00616.53
7.3.240.0180.00016.53
7.3.230.0160.00316.61
7.3.210.0130.00316.53
7.3.200.0130.00319.39
7.3.190.0050.01016.84
7.3.180.0130.00316.77
7.3.170.0160.01016.53
7.3.160.0080.00816.63
7.3.120.0080.01015.13
7.3.110.0030.01514.87
7.3.100.0090.00614.83
7.3.90.0000.01315.21
7.3.80.0070.00715.37
7.3.70.0030.00615.15
7.3.60.0000.01315.19
7.3.50.0060.00315.13
7.3.40.0040.00715.10
7.3.30.0080.00814.93
7.3.20.0070.00716.68
7.3.10.0070.00316.97
7.3.00.0030.00916.80
7.2.330.0060.01216.88
7.2.320.0060.01216.70
7.2.310.0060.01316.78
7.2.300.0100.00616.85
7.2.290.0080.00816.80
7.2.250.0070.01015.10
7.2.240.0060.01215.22
7.2.230.0090.00615.37
7.2.220.0060.00615.05
7.2.210.0000.01115.43
7.2.200.0040.00715.34
7.2.190.0030.00615.12
7.2.180.0070.01115.17
7.2.170.0120.00315.21
7.2.160.0070.01115.34
7.2.150.0080.00617.05
7.2.140.0040.00817.05
7.2.130.0070.00716.88
7.2.120.0040.01116.81
7.2.110.0120.00016.77
7.2.100.0030.00917.20
7.2.90.0000.01517.15
7.2.80.0000.01417.01
7.2.70.0070.00716.98
7.2.60.0000.01417.13
7.2.50.0030.00717.09
7.2.40.0040.01117.13
7.2.30.0040.00717.29
7.2.20.0040.00816.89
7.2.10.0070.01117.35
7.2.00.0070.01017.11
7.1.330.0060.01215.77
7.1.320.0000.01615.88
7.1.310.0000.00916.13
7.1.300.0070.00715.98
7.1.290.0070.00715.70
7.1.280.0040.01415.77
7.1.270.0100.00315.91
7.1.260.0000.01215.96
7.1.250.0000.01315.91
7.1.240.0030.01215.86
7.1.230.0030.01015.93
7.1.220.0060.00616.14
7.1.210.0030.00716.00
7.1.200.0060.00616.07
7.1.190.0030.00615.74
7.1.180.0070.01016.16
7.1.170.0070.00715.77
7.1.160.0090.00016.15
7.1.150.0070.00715.95
7.1.140.0000.01715.97
7.1.130.0060.00915.91
7.1.120.0070.00716.00
7.1.110.0060.00916.10
7.1.100.0100.00316.03
7.1.90.0070.00715.75
7.1.80.0000.01116.05
7.1.70.0070.00716.64
7.1.60.0070.01117.54
7.1.50.0050.01216.57
7.1.40.0070.00616.00
7.1.30.0030.01116.11
7.1.20.0060.00915.74
7.1.10.0100.00715.94
7.1.00.0070.02819.21
7.0.330.0040.00715.63
7.0.320.0050.00515.42
7.0.310.0120.00015.46
7.0.300.0100.00315.56
7.0.290.0080.00915.75
7.0.280.0070.00715.51
7.0.270.0030.00715.18
7.0.260.0080.00415.70
7.0.250.0060.00615.68
7.0.240.0030.01015.58
7.0.230.0040.01115.83
7.0.220.0030.01015.66
7.0.210.0130.00315.52
7.0.200.0030.00716.45
7.0.190.0040.01115.77
7.0.180.0070.00715.30
7.0.170.0070.01115.68
7.0.160.0000.01615.56
7.0.150.0070.00415.61
7.0.140.0060.03918.94
7.0.130.0040.00415.68
7.0.120.0000.01315.70
7.0.110.0060.00615.63
7.0.100.0040.01115.38
7.0.90.0030.00915.76
7.0.80.0030.01015.69
7.0.70.0090.02818.66
7.0.60.0100.04318.80
7.0.50.0030.04818.95
7.0.40.0050.02516.91
7.0.30.0040.04816.86
7.0.20.0100.04316.78
7.0.10.0080.04316.93
7.0.00.0080.03816.69
5.6.400.0070.00714.84
5.6.390.0070.01014.55
5.6.380.0030.01014.45
5.6.370.0030.00614.64
5.6.360.0000.01414.71
5.6.350.0070.00714.52
5.6.340.0070.01014.70
5.6.330.0080.00614.24
5.6.320.0080.00414.64
5.6.310.0030.01014.52
5.6.300.0050.00514.80
5.6.290.0090.00614.38
5.6.280.0050.04117.77
5.6.270.0090.00314.74
5.6.260.0070.01014.49
5.6.250.0120.00414.65
5.6.240.0070.00314.46
5.6.230.0070.00314.37
5.6.220.0040.04317.57
5.6.210.0050.04517.62
5.6.200.0050.04417.96
5.6.190.0090.03217.79
5.6.180.0030.05017.82
5.6.170.0050.03617.78
5.6.160.0070.03417.74
5.6.150.0100.04317.81
5.6.140.0070.04717.79
5.6.130.0070.02817.96
5.6.120.0070.04417.95
5.6.110.0080.04017.77
5.6.100.0090.04417.73
5.6.90.0030.05017.68
5.6.80.0070.03817.54
5.6.70.0080.04317.30
5.6.60.0050.02817.42
5.6.50.0050.04317.50
5.6.40.0030.04517.50
5.6.30.0050.03617.38
5.6.20.0110.03717.41
5.6.10.0070.04217.51
5.6.00.0030.05017.34
5.5.380.0060.00314.23
5.5.370.0030.00914.43
5.5.360.0050.04917.21
5.5.350.0080.04317.23
5.5.340.0050.03317.73
5.5.330.0030.03117.74
5.5.320.0100.03917.77
5.5.310.0090.04617.74
5.5.300.0080.04217.72
5.5.290.0020.04017.58
5.5.280.0030.04017.55
5.5.270.0100.04517.56
5.5.260.0030.03317.50
5.5.250.0110.04017.43
5.5.240.0100.04017.11
5.5.230.0050.04117.41
5.5.220.0060.03217.25
5.5.210.0050.04217.34
5.5.200.0080.02317.39
5.5.190.0040.03717.31
5.5.180.0070.03217.38
5.5.170.0000.01414.43
5.5.160.0030.04817.38
5.5.150.0070.04617.23
5.5.140.0050.04717.23
5.5.130.0050.02717.31
5.5.120.0050.04517.19
5.5.110.0070.04117.20
5.5.100.0030.04717.20
5.5.90.0040.02617.12
5.5.80.0070.03817.18
5.5.70.0110.03717.31
5.5.60.0020.04917.03
5.5.50.0080.04217.05
5.5.40.0080.04317.21
5.5.30.0020.04517.25
5.5.20.0100.02817.22
5.5.10.0050.03517.06
5.5.00.0060.04117.13
5.4.450.0030.02816.13
5.4.440.0090.04016.14
5.4.430.0070.02716.08
5.4.420.0030.03816.18
5.4.410.0080.03716.08
5.4.400.0060.04015.96
5.4.390.0020.04815.84
5.4.380.0050.03215.84
5.4.370.0050.04015.91
5.4.360.0050.04115.85
5.4.350.0030.04415.92
5.4.340.0070.02315.82
5.4.330.0030.00912.80
5.4.320.0080.03816.01
5.4.310.0120.03015.87
5.4.300.0090.02515.82
5.4.290.0110.03915.97
5.4.280.0050.04015.92
5.4.270.0030.02916.00
5.4.260.0020.04515.98
5.4.250.0070.03515.96
5.4.240.0080.02815.92
5.4.230.0050.04015.95
5.4.220.0020.04415.92
5.4.210.0050.03215.83
5.4.200.0070.04315.87
5.4.190.0030.04315.91
5.4.180.0050.04015.95
5.4.170.0080.03315.96
5.4.160.0050.03915.91
5.4.150.0070.04215.82
5.4.140.0050.04014.66
5.4.130.0090.03814.56
5.4.120.0030.04014.65
5.4.110.0070.04014.56
5.4.100.0060.04014.66
5.4.90.0020.02914.68
5.4.80.0050.01814.61
5.4.70.0050.03814.63
5.4.60.0070.04014.57
5.4.50.0080.04014.64
5.4.40.0020.04414.63
5.4.30.0050.04014.61
5.4.20.0070.03714.62
5.4.10.0040.03414.58
5.4.00.0030.04114.33
5.3.290.0030.03313.80
5.3.280.0030.04413.71
5.3.270.0020.04513.71
5.3.260.0030.04413.78
5.3.250.0050.03813.78
5.3.240.0050.03013.76
5.3.230.0050.04013.76
5.3.220.0030.03113.75
5.3.210.0030.04213.68
5.3.200.0090.03913.72
5.3.190.0070.02213.67
5.3.180.0050.04013.72
5.3.170.0070.02213.67
5.3.160.0030.02213.74
5.3.150.0050.04213.71
5.3.140.0080.03513.72
5.3.130.0030.02313.74
5.3.120.0030.03913.69
5.3.110.0030.03213.68
5.3.100.0060.04213.44
5.3.90.0080.03513.42
5.3.80.0020.03613.43
5.3.70.0060.02813.44
5.3.60.0050.03513.45
5.3.50.0020.03913.44
5.3.40.0000.04213.34
5.3.30.0030.03813.31
5.3.20.0080.03613.22
5.3.10.0040.03513.21
5.3.00.0060.03513.24
5.2.170.0030.06011.19
5.2.160.0070.06011.27
5.2.150.0000.07011.05
5.2.140.0000.06711.02
5.2.130.0070.06011.04
5.2.120.0030.05711.02
5.2.110.0030.06011.11
5.2.100.0100.05711.21
5.2.90.0070.05311.02
5.2.80.0030.06011.04
5.2.70.0030.05311.22
5.2.60.0030.06310.98
5.2.50.0030.05311.07
5.2.40.0000.06011.03
5.2.30.0070.05011.11
5.2.20.0070.05711.11
5.2.10.0100.04010.96
5.2.00.0070.03710.96
5.1.60.0030.05010.96
5.1.50.0070.04710.96
5.1.40.0030.05310.96
5.1.30.0000.06010.96
5.1.20.0000.04710.96
5.1.10.0030.04010.96
5.1.00.0030.05310.96
5.0.50.0030.04710.96
5.0.40.0070.04310.96
5.0.30.0070.06010.96
5.0.20.0030.03010.96
5.0.10.0000.04310.96
5.0.00.0000.07010.96
4.4.90.0000.03010.96
4.4.80.0070.03010.96
4.4.70.0000.03310.96
4.4.60.0000.03310.96
4.4.50.0070.02310.96
4.4.40.0070.04710.96
4.4.30.0000.03710.96
4.4.20.0070.02710.96
4.4.10.0000.03010.96
4.4.00.0000.05310.96
4.3.110.0000.03710.96
4.3.100.0000.02710.96
4.3.90.0000.03310.96
4.3.80.0000.04010.96
4.3.70.0030.02310.96
4.3.60.0000.03010.96
4.3.50.0030.03310.96
4.3.40.0000.03310.96
4.3.30.0030.01310.96
4.3.20.0000.01710.96
4.3.10.0000.02310.96
4.3.00.0000.02010.96

preferences:
40.29 ms | 400 KiB | 5 Q