3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'Comma Formatted: ' . nyx_number_format('1233332,34', 'comma') . ' - '; echo 'Dot Formatted: ' . nyx_number_format('1233332.34'); function nyx_number_format($number, $separator = 'dot') { // Default setting $thousand_separator = ','; $decimal_separator = '.'; if ($separator == 'comma') { $thousand_separator = '.'; $decimal_separator = ','; } // Remove the thousand separator $number = str_replace($thousand_separator, '', $number); // Make sure the Decimal separator is correct $number = str_replace($decimal_separator, '.', $number); if ($separator == 'comma') { return number_format($number, 2, ',', '.'); } return number_format($number, 2, '.', ','); }

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.0150.00916.50
8.3.50.0120.00917.27
8.3.40.0130.00318.89
8.3.30.0110.00418.79
8.3.20.0040.00418.65
8.3.10.0050.00320.61
8.3.00.0040.00417.63
8.2.180.0140.00716.50
8.2.170.0030.01422.96
8.2.160.0110.00422.23
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0000.00719.95
8.2.110.0090.00019.44
8.2.100.0120.00318.02
8.2.90.0030.00519.17
8.2.80.0000.00817.97
8.2.70.0050.00317.50
8.2.60.0060.00317.93
8.2.50.0040.00418.07
8.2.40.0000.00818.03
8.2.30.0040.00418.24
8.2.20.0070.00017.66
8.2.10.0050.00517.75
8.2.00.0030.00717.77
8.1.280.0190.00325.92
8.1.270.0080.00023.99
8.1.260.0030.00526.35
8.1.250.0090.00028.09
8.1.240.0100.00020.91
8.1.230.0060.00620.88
8.1.220.0000.00818.77
8.1.210.0030.00619.00
8.1.200.0030.00617.47
8.1.190.0050.00317.52
8.1.180.0040.00418.10
8.1.170.0000.00819.04
8.1.160.0040.00419.03
8.1.150.0040.00418.79
8.1.140.0030.00617.52
8.1.130.0030.00317.90
8.1.120.0000.00717.53
8.1.110.0040.00417.57
8.1.100.0040.00417.57
8.1.90.0030.00417.43
8.1.80.0040.00417.57
8.1.70.0000.00817.50
8.1.60.0050.00217.71
8.1.50.0060.00317.57
8.1.40.0000.00717.48
8.1.30.0040.00417.73
8.1.20.0040.00417.79
8.1.10.0050.00317.59
8.1.00.0040.00417.41
8.0.300.0000.00820.02
8.0.290.0000.00716.75
8.0.280.0070.00018.54
8.0.270.0000.00717.21
8.0.260.0030.00316.91
8.0.250.0050.00216.89
8.0.240.0030.00717.02
8.0.230.0070.00017.02
8.0.220.0000.00716.98
8.0.210.0040.00416.88
8.0.200.0070.00017.04
8.0.190.0000.00717.02
8.0.180.0000.00816.97
8.0.170.0030.00616.96
8.0.160.0050.00317.00
8.0.150.0040.00416.92
8.0.140.0000.00816.90
8.0.130.0060.00013.39
8.0.120.0040.00416.82
8.0.110.0030.00617.04
8.0.100.0040.00417.02
8.0.90.0040.00416.90
8.0.80.0090.00617.00
8.0.70.0000.00816.76
8.0.60.0000.00716.77
8.0.50.0000.00716.99
8.0.30.0110.00817.00
8.0.20.0100.00917.15
8.0.10.0040.00417.15
8.0.00.0100.00916.75
7.4.330.0000.00513.05
7.4.320.0000.00716.48
7.4.300.0040.00416.63
7.4.290.0030.00316.68
7.4.280.0070.00316.69
7.4.270.0000.00716.62
7.4.260.0030.00313.33
7.4.250.0000.00816.65
7.4.240.0000.00716.58
7.4.230.0000.00716.75
7.4.220.0060.00916.68
7.4.210.0040.00916.55
7.4.200.0030.00316.69
7.4.190.0030.00316.76
7.4.160.0080.00816.79
7.4.150.0090.00916.59
7.4.140.0090.00816.53
7.4.130.0080.01116.65
7.4.120.0080.00816.55
7.4.110.0100.00716.71
7.4.100.0210.00016.39
7.4.90.0140.00316.71
7.4.80.0060.01216.77
7.4.70.0140.00716.62
7.4.60.0090.00916.66
7.4.50.0060.00316.60
7.4.40.0150.00316.70
7.4.30.0080.00816.63
7.4.00.0060.00814.99
7.3.330.0030.00313.30
7.3.320.0030.00313.30
7.3.310.0070.00016.37
7.3.300.0030.00316.26
7.3.290.0060.00916.36
7.3.280.0090.00816.35
7.3.270.0080.00816.41
7.3.260.0140.00716.55
7.3.250.0150.00316.49
7.3.240.0040.01216.38
7.3.230.0140.00316.70
7.3.210.0000.01816.60
7.3.200.0090.01019.39
7.3.190.0120.00616.50
7.3.180.0100.00616.60
7.3.170.0040.01616.43
7.3.160.0030.01716.60
7.3.120.0090.00915.01
7.3.110.0080.00415.02
7.3.100.0040.01114.82
7.3.90.0000.01514.91
7.3.80.0030.00914.76
7.3.70.0000.01414.75
7.3.60.0080.00814.68
7.3.50.0000.01415.01
7.3.40.0030.00614.61
7.3.30.0060.00914.96
7.3.20.0060.01116.74
7.3.10.0060.00916.68
7.3.00.0080.00416.65
7.2.330.0130.00416.92
7.2.320.0170.00016.79
7.2.310.0170.00616.82
7.2.300.0140.00316.76
7.2.290.0090.00816.51
7.2.250.0190.00015.22
7.2.240.0070.01414.74
7.2.230.0060.00615.00
7.2.220.0080.00815.12
7.2.210.0050.00515.13
7.2.200.0030.01014.81
7.2.190.0100.00714.80
7.2.180.0040.01114.83
7.2.170.0030.00614.87
7.2.80.0060.00616.68
7.2.60.0180.00516.80
7.2.00.0030.01119.51
7.1.330.0030.01315.47
7.1.320.0040.01115.53
7.1.310.0060.00615.91
7.1.300.0060.00915.80
7.1.290.0080.00415.75
7.1.280.0060.00615.46
7.1.270.0140.00015.56
7.1.260.0060.00915.75
7.1.200.0100.00315.57
7.1.100.0040.00418.03
7.1.70.0000.00717.15
7.1.60.0030.02019.40
7.1.50.0110.01116.92
7.1.00.0030.06022.54
7.0.200.0070.00016.86
7.0.140.0000.07322.11
7.0.120.0030.07322.03
7.0.60.0100.06719.90
7.0.50.0100.08017.88
7.0.40.0200.06317.69
7.0.30.0030.05717.76
7.0.20.0070.08317.86
7.0.10.0070.08317.75
7.0.00.0130.08017.85
5.6.280.0070.07021.13
5.6.210.0070.06320.48
5.6.200.0030.08018.18
5.6.190.0070.05018.14
5.6.180.0100.06718.14
5.6.170.0070.08018.29
5.6.160.0130.07318.15
5.6.150.0130.06718.29
5.6.140.0070.08718.11
5.6.130.0030.08018.14
5.6.120.0070.04018.17
5.6.110.0130.06718.17
5.6.100.0070.04318.15
5.6.90.0100.05718.10
5.6.80.0100.07017.51
5.6.70.0030.08017.50
5.6.60.0070.07717.60
5.6.50.0100.07717.67
5.6.40.0030.04717.50
5.6.30.0070.04717.48
5.6.20.0100.07717.64
5.6.10.0100.08317.62
5.6.00.0170.07717.49
5.5.350.0000.07020.43
5.5.340.0100.07717.95
5.5.330.0100.06717.98
5.5.320.0170.05717.95
5.5.310.0070.08317.98
5.5.300.0070.08018.00
5.5.290.0070.04317.95
5.5.280.0130.06718.01
5.5.270.0030.09018.01
5.5.260.0070.08318.09
5.5.250.0070.04317.73
5.5.240.0070.06717.48
5.5.230.0000.04717.32
5.5.220.0200.05017.46
5.5.210.0070.05017.30
5.5.200.0070.03717.43
5.5.190.0100.07317.34
5.5.180.0000.05717.32
5.5.160.0130.04017.27
5.5.150.0070.06717.29
5.5.140.0100.05017.29
5.5.130.0130.07017.27
5.5.120.0070.04317.27
5.5.110.0070.06017.41
5.5.100.0100.06717.17
5.5.90.0100.05017.22
5.5.80.0030.08017.23
5.5.70.0070.07717.32
5.5.60.0070.06317.22
5.5.50.0030.05317.19
5.5.40.0170.06317.22
5.5.30.0070.07717.23
5.5.20.0030.07017.31
5.5.10.0170.07017.21
5.5.00.0070.07717.31
5.4.450.0100.07719.34
5.4.440.0170.05019.51
5.4.430.0100.04319.43
5.4.420.0100.05319.43
5.4.410.0030.04319.30
5.4.400.0030.07318.93
5.4.390.0030.06319.16
5.4.380.0070.04019.07
5.4.370.0070.08019.16
5.4.360.0070.04319.13
5.4.350.0000.05719.11
5.4.340.0100.07719.12
5.4.320.0070.04019.16
5.4.310.0070.04318.95
5.4.300.0030.07019.11
5.4.290.0100.06719.01
5.4.280.0170.06719.14
5.4.270.0000.05319.04
5.4.260.0030.05719.11
5.4.250.0200.03719.04
5.4.240.0070.05719.14
5.4.230.0130.06019.02
5.4.220.0100.06719.26
5.4.210.0070.07019.13
5.4.200.0070.04319.04
5.4.190.0070.07719.09
5.4.180.0170.06319.11
5.4.170.0100.04319.06
5.4.160.0070.06019.10
5.4.150.0100.06719.03
5.4.140.0170.06316.49
5.4.130.0100.06716.36
5.4.120.0100.05316.34
5.4.110.0070.07716.46
5.4.100.0030.07016.29
5.4.90.0100.07016.23
5.4.80.0200.06016.30
5.4.70.0070.07016.43
5.4.60.0070.04316.45
5.4.50.0030.04016.26
5.4.40.0000.03716.55
5.4.30.0030.03316.45
5.4.20.0000.03716.29
5.4.10.0070.03016.52
5.4.00.0100.03316.07
5.3.290.0030.07714.80
5.3.280.0030.06014.64
5.3.270.0100.07314.66
5.3.260.0100.07314.63
5.3.250.0070.07714.70
5.3.240.0070.06314.62
5.3.230.0130.07014.72
5.3.220.0070.04014.67
5.3.210.0100.03714.64
5.3.200.0000.04314.72
5.3.190.0070.08014.66
5.3.180.0030.08314.57
5.3.170.0030.07314.70
5.3.160.0000.05014.66
5.3.150.0100.03014.66
5.3.140.0070.03714.68
5.3.130.0030.04314.65
5.3.120.0000.04014.58
5.3.110.0000.04314.58
5.3.100.0000.03714.05
5.3.90.0000.03714.01
5.3.80.0000.04014.03
5.3.70.0030.03714.11
5.3.60.0030.03714.02
5.3.50.0000.03713.95
5.3.40.0070.03013.93
5.3.30.0030.03314.01
5.3.20.0000.03713.74
5.3.10.0030.03313.69
5.3.00.0030.03313.68
5.2.170.0070.02311.37
5.2.160.0030.02711.23
5.2.150.0070.02311.33
5.2.140.0000.03011.12
5.2.130.0030.02711.06
5.2.120.0070.02311.27
5.2.110.0030.02711.08
5.2.100.0030.02711.33
5.2.90.0070.02711.44
5.2.80.0070.02311.21
5.2.70.0030.02711.25
5.2.60.0000.03011.02
5.2.50.0000.03011.06
5.2.40.0030.02710.96
5.2.30.0030.02711.08
5.2.20.0030.02711.16
5.2.10.0000.03010.98
5.2.00.0000.03310.97
5.1.60.0030.02010.05
5.1.50.0000.02310.09
5.1.40.0030.02310.08
5.1.30.0000.03010.52
5.1.20.0000.02710.42
5.1.10.0030.02310.41
5.1.00.0030.02710.27
5.0.50.0000.0208.60
5.0.40.0000.0208.36
5.0.30.0000.0308.38
5.0.20.0000.0378.25
5.0.10.0000.0278.27
5.0.00.0000.0708.32
4.4.90.0000.0177.55
4.4.80.0000.0137.55
4.4.70.0030.0137.55
4.4.60.0030.0137.55
4.4.50.0000.0177.55
4.4.40.0030.0207.55
4.4.30.0000.0137.55
4.4.20.0000.0177.55
4.4.10.0030.0137.55
4.4.00.0000.0237.55
4.3.110.0000.0137.55
4.3.100.0030.0237.55
4.3.90.0000.0237.55
4.3.80.0030.0407.55
4.3.70.0000.0207.55
4.3.60.0030.0307.55
4.3.50.0000.0377.55
4.3.40.0000.0437.55
4.3.30.0000.0377.55
4.3.20.0000.0407.55
4.3.10.0000.0207.55
4.3.00.0030.0307.55

preferences:
42.38 ms | 401 KiB | 5 Q