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.0040.01416.88
8.3.50.0100.00817.50
8.3.40.0060.00918.95
8.3.30.0110.00418.92
8.3.20.0040.00418.88
8.3.10.0080.00019.20
8.3.00.0000.01217.75
8.2.180.0140.00716.75
8.2.170.0110.00422.96
8.2.160.0090.00621.17
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0050.00226.16
8.2.120.0040.00420.89
8.2.110.0040.00721.09
8.2.100.0000.01218.09
8.2.90.0090.00319.47
8.2.80.0040.00419.34
8.2.70.0030.00517.88
8.2.60.0050.00318.05
8.2.50.0000.00818.07
8.2.40.0000.00918.34
8.2.30.0050.00318.07
8.2.20.0030.00619.73
8.2.10.0000.00817.95
8.2.00.0000.00717.87
8.1.280.0150.00425.92
8.1.270.0040.00424.66
8.1.260.0060.00326.35
8.1.250.0070.00028.09
8.1.240.0100.00022.54
8.1.230.0060.00620.92
8.1.220.0040.00417.78
8.1.210.0030.00619.23
8.1.200.0070.00317.48
8.1.190.0060.00317.66
8.1.180.0040.00418.10
8.1.170.0030.00519.03
8.1.160.0050.00219.00
8.1.150.0000.00818.89
8.1.140.0030.00617.64
8.1.130.0080.00017.76
8.1.120.0050.00217.51
8.1.110.0040.00417.52
8.1.100.0040.00417.63
8.1.90.0000.00717.55
8.1.80.0000.00817.57
8.1.70.0070.00017.55
8.1.60.0030.00617.73
8.1.50.0040.00417.67
8.1.40.0050.00317.72
8.1.30.0050.00317.71
8.1.20.0050.00317.86
8.1.10.0000.00817.80
8.1.00.0040.00417.75
8.0.300.0080.00020.11
8.0.290.0000.00817.13
8.0.280.0030.00318.38
8.0.270.0000.00717.32
8.0.260.0070.00016.94
8.0.250.0000.00717.24
8.0.240.0000.00717.13
8.0.230.0000.00817.24
8.0.220.0000.00717.18
8.0.210.0040.00417.12
8.0.200.0070.00017.20
8.0.190.0030.00517.22
8.0.180.0040.00817.19
8.0.170.0070.00317.14
8.0.160.0000.00817.19
8.0.150.0000.00817.12
8.0.140.0070.00017.14
8.0.130.0050.00013.52
8.0.120.0080.00017.09
8.0.110.0030.00616.91
8.0.100.0000.00717.09
8.0.90.0000.00717.09
8.0.80.0110.01017.14
8.0.70.0050.00317.21
8.0.60.0080.00017.00
8.0.50.0000.00817.13
8.0.30.0110.00717.41
8.0.20.0130.00917.28
8.0.10.0000.00817.15
8.0.00.0110.00817.13
7.4.330.0050.00013.23
7.4.320.0030.00316.86
7.4.300.0000.00916.70
7.4.290.0000.00716.89
7.4.280.0000.00816.78
7.4.270.0000.00716.73
7.4.260.0030.00313.52
7.4.250.0090.00016.88
7.4.240.0040.00416.76
7.4.230.0040.00416.50
7.4.220.0070.01716.80
7.4.210.0120.00616.82
7.4.200.0040.00316.83
7.4.190.0040.00416.80
7.4.160.0080.00816.82
7.4.150.0110.00716.82
7.4.140.0040.01316.55
7.4.130.0070.00916.81
7.4.120.0070.01016.76
7.4.110.0090.01616.73
7.4.100.0110.00716.87
7.4.90.0030.01516.82
7.4.80.0070.01119.39
7.4.70.0120.00616.66
7.4.60.0030.01416.81
7.4.50.0090.00316.79
7.4.40.0090.00316.67
7.4.30.0120.00616.70
7.4.10.0100.00715.10
7.4.00.0110.00615.26
7.3.330.0030.00313.55
7.3.320.0030.00313.61
7.3.310.0000.00716.43
7.3.300.0000.00716.61
7.3.290.0000.01516.58
7.3.280.0080.01016.58
7.3.270.0130.00716.78
7.3.260.0140.00416.54
7.3.250.0160.00916.74
7.3.240.0140.00316.61
7.3.230.0060.01216.69
7.3.210.0040.01416.58
7.3.200.0100.00716.77
7.3.190.0060.01216.84
7.3.180.0030.01316.75
7.3.170.0140.00316.59
7.3.160.0060.00916.64
7.3.130.0130.00615.10
7.3.120.0070.01115.25
7.3.110.0100.01015.04
7.3.100.0080.00614.92
7.3.90.0130.00315.05
7.3.80.0090.00615.32
7.3.70.0000.01614.85
7.3.60.0060.01014.99
7.3.50.0030.01015.13
7.3.40.0120.00615.24
7.3.30.0060.00614.77
7.3.20.0040.01116.70
7.3.10.0010.00916.88
7.3.00.0000.01116.94
7.2.330.0120.00616.89
7.2.320.0140.00716.63
7.2.310.0120.00617.05
7.2.300.0130.00316.96
7.2.290.0130.00316.93
7.2.260.0110.00015.18
7.2.250.0100.00715.41
7.2.240.0090.00615.14
7.2.230.0070.00715.42
7.2.220.0060.00615.44
7.2.210.0040.00815.31
7.2.200.0000.01315.23
7.2.190.0040.00915.26
7.2.180.0000.01415.20
7.2.170.0120.00315.35
7.2.160.0060.00915.44
7.2.150.0070.00717.07
7.2.140.0060.00317.23
7.2.130.0040.01117.01
7.2.120.0050.00517.16
7.2.110.0020.01117.14
7.2.100.0060.00616.94
7.2.90.0120.00316.94
7.2.80.0040.01217.25
7.2.70.0060.00617.05
7.2.60.0070.00616.96
7.2.50.0130.00717.09
7.2.40.0030.00817.05
7.2.30.0070.00717.17
7.2.20.0050.01017.19
7.2.10.0050.00817.07
7.2.00.0050.00616.96
7.1.330.0000.01415.98
7.1.320.0000.01315.77
7.1.310.0090.00316.14
7.1.300.0000.00915.72
7.1.290.0120.00315.75
7.1.280.0000.01315.98
7.1.270.0000.01316.14
7.1.260.0050.00516.05
7.1.250.0030.00915.95
7.1.240.0030.00616.03
7.1.230.0070.00715.86
7.1.220.0070.00316.16
7.1.210.0100.00316.16
7.1.200.0090.00216.12
7.1.190.0040.00716.14
7.1.180.0090.00316.10
7.1.170.0030.01016.16
7.1.160.0100.00716.00
7.1.150.0030.01016.02
7.1.140.0080.00615.74
7.1.130.0030.01015.97
7.1.120.0070.01115.75
7.1.110.0080.00716.02
7.1.100.0090.00615.95
7.1.90.0100.00316.06
7.1.80.0110.00416.00
7.1.70.0030.00516.61
7.1.60.0100.01017.73
7.1.50.0050.01016.49
7.1.40.0060.00315.96
7.1.30.0030.00916.04
7.1.20.0000.01316.06
7.1.10.0000.01215.95
7.1.00.0050.04119.19
7.0.330.0030.00615.80
7.0.320.0070.00715.57
7.0.310.0030.01015.63
7.0.300.0040.00715.67
7.0.290.0030.00615.69
7.0.280.0070.00715.74
7.0.270.0030.01015.70
7.0.260.0000.00915.39
7.0.250.0000.01615.75
7.0.240.0070.00715.63
7.0.230.0040.00415.54
7.0.220.0090.00315.55
7.0.210.0030.00615.66
7.0.200.0300.00515.45
7.0.190.0050.00515.51
7.0.180.0120.00315.49
7.0.170.0000.01315.81
7.0.160.0070.00715.61
7.0.150.0070.00715.59
7.0.140.0030.04318.78
7.0.130.0100.00715.77
7.0.120.0020.04118.88
7.0.110.0030.01015.35
7.0.100.0110.00315.46
7.0.90.0030.00915.68
7.0.80.0070.00715.60
7.0.70.0030.00515.59
7.0.60.0050.04517.89
7.0.50.0030.04416.86
7.0.40.0020.03616.92
7.0.30.0130.02717.02
7.0.20.0140.03117.01
7.0.10.0020.05216.85
7.0.00.0080.04416.91
5.6.400.0070.00714.48
5.6.390.0040.01214.41
5.6.380.0000.01214.66
5.6.370.0070.01014.78
5.6.360.0040.00414.65
5.6.350.0060.01214.48
5.6.340.0040.01114.40
5.6.330.0090.00314.39
5.6.320.0000.01214.61
5.6.310.0080.00814.76
5.6.300.0070.00714.80
5.6.290.0030.01414.48
5.6.280.0030.04017.70
5.6.270.0100.00314.64
5.6.260.0040.01114.31
5.6.250.0080.00414.46
5.6.240.0040.01114.46
5.6.230.0000.01314.52
5.6.220.0050.00514.68
5.6.210.0080.03517.71
5.6.200.0080.04616.24
5.6.190.0100.03617.62
5.6.180.1580.02617.38
5.6.170.0130.04517.35
5.6.160.0030.04517.46
5.6.150.0030.03216.46
5.6.140.0050.03216.23
5.6.130.0080.02816.42
5.6.120.0070.04617.63
5.6.110.0040.05017.69
5.6.100.0070.03817.66
5.6.90.0110.04117.69
5.6.80.0000.02617.48
5.6.70.2300.01817.35
5.6.60.0090.00614.38
5.6.50.0030.00614.64
5.6.40.0040.00814.28
5.6.30.0000.01514.32
5.6.20.0090.00014.25
5.6.10.0080.00414.36
5.6.00.0030.00614.43
5.5.380.0100.00314.58
5.5.370.0030.00914.09
5.5.360.0040.00414.47
5.5.350.0130.04717.26
5.5.340.0080.04116.35
5.5.330.0070.04717.64
5.5.320.0200.04517.30
5.5.310.0160.04017.33
5.5.300.0140.03216.34
5.5.290.0100.02816.32
5.5.280.0070.03217.65
5.5.270.0080.04317.53
5.5.260.0070.04817.59
5.5.250.0060.04017.55
5.5.240.0100.02917.37
5.5.230.0100.00614.38
5.5.220.0040.00814.15
5.5.210.0100.00714.36
5.5.200.0050.00314.33
5.5.190.0080.00414.04
5.5.180.0000.01314.16
5.5.170.0030.01014.27
5.5.160.0060.00614.47
5.5.150.0090.00614.52
5.5.140.0170.00314.20
5.5.130.0000.01114.55
5.5.120.0070.00414.44
5.5.110.0080.00414.29
5.5.100.0100.00014.48
5.5.90.0070.00714.52
5.5.80.0040.00714.35
5.5.70.0040.00714.36
5.5.60.0030.00714.63
5.5.50.0040.00814.19
5.5.40.0000.01414.35
5.5.30.0070.00714.34
5.5.20.0030.00514.57
5.5.10.0000.01114.52
5.5.00.0070.00714.57
5.4.450.0030.02815.41
5.4.440.0090.01815.39
5.4.430.0000.02815.18
5.4.420.0030.02515.30
5.4.410.0080.02815.43
5.4.400.0070.03015.27
5.4.390.0070.02715.21
5.4.380.0070.03914.93
5.4.370.0030.04515.10
5.4.360.0060.03415.20
5.4.350.0030.04614.95
5.4.340.0030.03514.96
5.4.330.0060.00611.27
5.4.320.0030.03114.89
5.4.310.0030.03415.21
5.4.300.0070.03715.25
5.4.290.0050.04015.04
5.4.280.0100.03715.25
5.4.270.0070.02015.22
5.4.260.0060.03615.14
5.4.250.0070.03815.03
5.4.240.0050.03915.14
5.4.230.0030.03015.23
5.4.220.0050.02815.12
5.4.210.0040.02215.11
5.4.200.0120.03515.29
5.4.190.0050.03015.20
5.4.180.0080.03215.18
5.4.170.0010.03115.10
5.4.160.0070.02215.32
5.4.150.0020.02815.18
5.4.140.0030.04013.77
5.4.130.0030.02713.92
5.4.120.0100.03713.80
5.4.110.0050.03613.65
5.4.100.0070.03513.85
5.4.90.0020.03213.83
5.4.80.0050.02513.79
5.4.70.0050.02213.59
5.4.60.0090.01913.84
5.4.50.0090.02813.79
5.4.40.0090.03713.72
5.4.30.0060.02613.88
5.4.20.0040.03213.91
5.4.10.0050.03513.71
5.4.00.0070.02513.60
5.3.290.0100.03612.67
5.3.280.0060.02312.50
5.3.270.0080.04212.67
5.3.260.0120.03212.70
5.3.250.0100.03012.72
5.3.240.0120.03512.60
5.3.230.0090.04012.61
5.3.220.0060.04012.51
5.3.210.0050.03112.69
5.3.200.0040.04312.62
5.3.190.0080.04512.63
5.3.180.0080.02912.65
5.3.170.0050.02712.71
5.3.160.0100.02212.70
5.3.150.0060.04112.72
5.3.140.0050.02812.54
5.3.130.0110.04012.73
5.3.120.0100.03512.70
5.3.110.0120.03812.70
5.3.100.0080.02012.39
5.3.90.0020.02712.35
5.3.80.0080.02412.40
5.3.70.0060.02612.28
5.3.60.0040.03912.28
5.3.50.0140.03612.34
5.3.40.0050.03412.36
5.3.30.0060.02612.31
5.3.20.0080.02012.07
5.3.10.0060.02312.00
5.3.00.0060.03311.92
5.2.170.0030.03711.20
5.2.160.0070.06311.32
5.2.150.0070.06011.33
5.2.140.0100.02711.23
5.2.130.0000.03311.18
5.2.120.0030.03011.10
5.2.110.0030.06311.08
5.2.100.0030.06011.07
5.2.90.0030.05311.08
5.2.80.0100.03311.27
5.2.70.0030.03311.19
5.2.60.0030.06311.16
5.2.50.0170.03311.20
5.2.40.0030.05311.02
5.2.30.0030.04711.01
5.2.20.0100.06011.00
5.2.10.0030.06310.88
5.2.00.0030.06310.79
5.1.60.0070.04310.07
5.1.50.0000.03710.01
5.1.40.0030.05710.02
5.1.30.0030.06010.52
5.1.20.0070.05310.37
5.1.10.0030.06010.00
5.1.00.0030.02710.16
5.0.50.0070.0308.50
5.0.40.0030.0478.45
5.0.30.0030.0538.22
5.0.20.0000.0338.30
5.0.10.0070.0438.35
5.0.00.0000.0638.16
4.4.90.0070.0207.82
4.4.80.0030.0277.82
4.4.70.0000.0337.82
4.4.60.0000.0377.82
4.4.50.0000.0207.82
4.4.40.0000.0577.82
4.4.30.0000.0407.82
4.4.20.0000.0277.82
4.4.10.0000.0407.82
4.4.00.0070.0307.82
4.3.110.0030.0337.82
4.3.100.0000.0307.82
4.3.90.0030.0337.82
4.3.80.0000.0577.82
4.3.70.0000.0337.82
4.3.60.0030.0237.82
4.3.50.0000.0207.82
4.3.40.0030.0277.82
4.3.30.0030.0307.82
4.3.20.0000.0237.82
4.3.10.0000.0377.82
4.3.00.0000.0377.82

preferences:
48.58 ms | 401 KiB | 5 Q