3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_number($number) { $str = number_format($number, 4, '.', ''); $str = preg_replace('/(?<\.\d{2})0+$/', '', $str); return $str; } var_dump(format_number(4.0)); var_dump(format_number(4.5)); var_dump(format_number(4.454)); var_dump(format_number(4.54545454)); var_dump(format_number(4.450));

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.0090.00618.82
8.3.30.0130.00320.14
8.3.20.0080.00020.58
8.3.10.0050.00320.96
8.3.00.0080.00023.48
8.2.170.0120.00622.96
8.2.160.0160.00320.22
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00020.79
8.2.110.0060.00319.45
8.2.100.0090.00317.91
8.2.90.0050.00319.26
8.2.80.0030.00518.04
8.2.70.0080.00017.38
8.2.60.0030.00618.04
8.2.50.0030.00518.07
8.2.40.0050.00318.28
8.2.30.0070.00019.56
8.2.20.0050.00317.77
8.2.10.0060.00317.74
8.2.00.0030.00517.71
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0070.00323.96
8.1.230.0060.00621.04
8.1.220.0000.00818.77
8.1.210.0080.00019.10
8.1.200.0060.00317.35
8.1.190.0040.00417.41
8.1.180.0000.00818.10
8.1.170.0050.00318.51
8.1.160.0070.00018.89
8.1.150.0050.00818.52
8.1.140.0070.00017.47
8.1.130.0080.00017.93
8.1.120.0000.00717.50
8.1.110.0040.00417.29
8.1.100.0040.00417.47
8.1.90.0020.00517.54
8.1.80.0070.00017.52
8.1.70.0070.00017.46
8.1.60.0060.00317.54
8.1.50.0030.00517.43
8.1.40.0040.00417.47
8.1.30.0040.00417.55
8.1.20.0030.00617.73
8.1.10.0000.00817.53
8.1.00.0050.00217.41
8.0.300.0040.00419.94
8.0.290.0040.00417.05
8.0.280.0000.00818.49
8.0.270.0030.00317.30
8.0.260.0040.00418.45
8.0.250.0030.00517.03
8.0.240.0000.00817.03
8.0.230.0040.00416.95
8.0.220.0030.00317.00
8.0.210.0080.00017.00
8.0.200.0030.00317.06
8.0.190.0040.00416.88
8.0.180.0020.00516.96
8.0.170.0080.00016.87
8.0.160.0000.00816.84
8.0.150.0040.00416.88
8.0.140.0030.00616.81
8.0.130.0030.00313.42
8.0.120.0040.00416.94
8.0.110.0040.00416.97
8.0.100.0050.00316.89
8.0.90.0000.00717.02
8.0.80.0040.01116.89
8.0.70.0050.00316.95
8.0.60.0040.00416.79
8.0.50.0000.00716.99
8.0.30.0110.00817.16
8.0.20.0080.01017.40
8.0.10.0080.00017.01
8.0.00.0140.00916.79
7.4.330.0000.00715.02
7.4.320.0030.00316.48
7.4.300.0000.00716.53
7.4.290.0050.00316.54
7.4.280.0030.00316.62
7.4.270.0000.00716.65
7.4.260.0030.00313.47
7.4.250.0040.00416.61
7.4.240.0030.00316.72
7.4.230.0050.00216.57
7.4.220.0070.01116.70
7.4.210.0060.01116.64
7.4.200.0050.00216.51
7.4.190.0030.00316.69
7.4.160.0110.00916.63
7.4.150.0100.01317.40
7.4.140.0080.00817.86
7.4.130.0110.00616.75
7.4.120.0090.00716.67
7.4.110.0070.01116.62
7.4.100.0100.01016.48
7.4.90.0120.01216.61
7.4.80.0030.01519.39
7.4.70.0060.01216.71
7.4.60.0070.01016.65
7.4.50.0030.00616.47
7.4.40.0070.01022.77
7.4.30.0130.00716.80
7.4.00.0060.00915.25
7.3.330.0070.00013.42
7.3.320.0020.00313.36
7.3.310.0000.00716.52
7.3.300.0030.00516.27
7.3.290.0060.00916.37
7.3.280.0100.00816.41
7.3.270.0120.00417.40
7.3.260.0100.00818.24
7.3.250.0140.00816.53
7.3.240.0090.01316.34
7.3.230.0080.00816.63
7.3.210.0130.00716.40
7.3.200.0100.01319.39
7.3.190.0110.00616.26
7.3.180.0090.00916.72
7.3.170.0110.00516.47
7.3.160.0180.00316.41
7.3.120.0030.01114.39
7.3.10.0120.00616.29
7.3.00.0040.01016.46
7.2.330.0080.01116.65
7.2.320.0180.00416.60
7.2.310.0030.01516.82
7.2.300.0030.01416.54
7.2.290.0090.00816.70
7.2.130.0030.00816.54
7.2.120.0080.00516.77
7.2.110.0110.00316.72
7.2.100.0030.01016.52
7.2.90.0050.00816.65
7.2.80.0050.00916.67
7.2.70.0110.00716.80
7.2.60.0050.00716.97
7.2.50.0100.00516.85
7.2.40.0130.00716.62
7.2.30.0130.00316.77
7.2.20.0080.00616.85
7.2.10.0070.00916.90
7.2.00.0110.00817.72
7.1.250.0060.00415.80
7.1.240.0120.00015.86
7.1.230.0070.00015.69
7.1.220.0000.01015.70
7.1.210.0030.00615.86
7.1.200.0040.00915.82
7.1.190.0030.01015.75
7.1.180.0040.00715.58
7.1.170.0040.00415.80
7.1.160.0000.00915.76
7.1.150.0040.00415.72
7.1.140.0030.00615.68
7.1.130.0030.00715.38
7.1.120.0120.00015.66
7.1.110.0000.01115.75
7.1.100.0050.01016.96
7.1.90.0090.00615.78
7.1.80.0050.00515.66
7.1.70.0030.00716.63
7.1.60.0050.01217.37
7.1.50.0050.00916.46
7.1.40.0060.00615.86
7.1.30.0000.01515.55
7.1.20.0030.01015.75
7.1.10.0060.00615.63
7.1.00.0050.02019.14
7.0.330.0030.00914.95
7.0.320.0100.00315.25
7.0.310.0030.00715.41
7.0.300.0000.01115.05
7.0.290.0030.00915.07
7.0.280.0060.00615.14
7.0.270.0060.00615.41
7.0.260.0040.00714.98
7.0.250.0080.00015.53
7.0.240.0060.00615.31
7.0.230.0040.00415.10
7.0.220.0070.00715.04
7.0.210.0040.00815.50
7.0.200.0270.00615.88
7.0.190.0080.00415.30
7.0.180.0030.01315.54
7.0.170.0130.00015.34
7.0.160.0100.00315.29
7.0.150.0060.00615.48
7.0.140.0040.04018.61
7.0.130.0030.00915.47
7.0.120.0070.00315.39
7.0.110.0030.01015.07
7.0.100.0060.02317.64
7.0.90.0190.02717.71
7.0.80.0020.04417.62
7.0.70.0110.04117.73
7.0.60.0080.02717.75
7.0.50.0110.03717.86
7.0.40.0080.03316.85
7.0.30.0050.03916.82
7.0.20.0050.03616.75
7.0.10.0060.02716.84
7.0.00.0070.03716.76
5.6.380.0030.00814.29
5.6.370.0040.01114.00
5.6.360.0030.01014.19
5.6.350.0060.00314.31
5.6.340.0030.00614.05
5.6.330.0000.01214.42
5.6.320.0100.00313.99
5.6.310.0040.00813.91
5.6.300.0030.00714.31
5.6.290.0000.01114.07
5.6.280.0080.03717.59
5.6.270.0000.01314.32
5.6.260.0030.01014.31
5.6.250.0100.03517.17
5.6.240.0070.02817.29
5.6.230.0100.04417.54
5.6.220.0100.04317.35
5.6.210.0080.03717.31
5.6.200.0050.02917.67
5.6.190.0040.02917.54
5.6.180.0030.03217.63
5.6.170.0050.03517.51
5.6.160.0130.03317.56
5.6.150.0070.02517.67
5.6.140.0050.03217.56
5.6.130.0070.03517.64
5.6.120.0050.02517.74
5.6.110.0050.03717.63
5.6.100.0120.02517.50
5.6.90.0050.03717.57
5.6.80.0070.02617.28
5.6.70.0070.02717.31
5.6.60.0020.02817.15
5.6.50.0090.02517.46
5.6.40.0060.03517.34
5.6.30.0060.02617.42
5.6.20.0100.03017.35
5.6.10.0080.02517.18
5.6.00.0050.02517.27
5.5.380.0090.02315.65
5.5.370.0070.04615.71
5.5.360.0070.04215.74
5.5.350.0020.04115.68
5.5.340.0030.03316.04
5.5.330.0070.04015.90
5.5.320.0060.02315.99
5.5.310.0070.02316.03
5.5.300.0050.04516.02
5.5.290.0020.03215.98
5.5.280.0060.02415.89
5.5.270.0030.02315.76
5.5.260.0080.02615.98
5.5.250.0040.02515.79
5.5.240.0030.02415.54
5.5.230.0150.02015.69
5.5.220.0030.02515.65
5.5.210.0090.03215.55
5.5.200.0070.02815.63
5.5.190.0050.03815.57
5.5.180.0070.03215.63
5.5.170.0030.00611.09
5.5.160.0050.02215.53
5.5.150.0040.03015.59
5.5.140.0070.02015.56
5.5.130.0030.04515.57
5.5.120.0080.02515.56
5.5.110.0100.02715.54
5.5.100.0030.03015.66
5.5.90.0030.02815.44
5.5.80.0050.02315.60
5.5.70.0010.03615.53
5.5.60.0110.02115.51
5.5.50.0070.02315.54
5.5.40.0030.03315.60
5.5.30.0050.03715.55
5.5.20.0070.02315.52
5.5.10.0120.03315.56
5.5.00.0060.03615.64
5.4.450.0020.04115.26
5.4.440.0130.01815.20
5.4.430.0050.03515.15
5.4.420.0030.03015.22
5.4.410.0050.02315.09
5.4.400.0090.02715.13
5.4.390.0030.02715.06
5.4.380.0080.03115.08
5.4.370.0070.01915.04
5.4.360.0050.02615.01
5.4.350.0000.02715.06
5.4.340.0130.04015.08
5.4.330.0030.00710.90
5.4.320.0090.02815.03
5.4.310.0070.02315.04
5.4.300.0040.02115.09
5.4.290.0080.02515.05
5.4.280.0030.02314.91
5.4.270.0080.03015.12
5.4.260.0020.03015.09
5.4.250.0040.02315.05
5.4.240.0030.03314.97
5.4.230.0030.02215.06
5.4.220.0080.02315.13
5.4.210.0030.03314.99
5.4.200.0020.02715.03
5.4.190.0030.04314.99
5.4.180.0030.02815.01
5.4.170.0070.03214.96
5.4.160.0040.02514.99
5.4.150.0070.02314.99
5.4.140.0060.03513.71
5.4.130.0150.02713.71
5.4.120.0070.03113.68
5.4.110.0050.02413.78
5.4.100.0020.02113.71
5.4.90.0070.01813.72
5.4.80.0030.04013.66
5.4.70.0070.02313.73
5.4.60.0030.02213.72
5.4.50.0030.04313.65
5.4.40.0050.02513.75
5.4.30.0050.02513.63
5.4.20.0030.03913.63
5.4.10.0030.02713.68
5.4.00.0080.02913.38
5.3.290.0070.02012.85
5.3.280.0030.03112.81
5.3.270.0080.03612.81
5.3.260.0040.02912.82
5.3.250.0080.04012.77
5.3.240.0050.04112.76
5.3.230.0060.03512.79
5.3.220.0090.02712.75
5.3.210.0050.02412.79
5.3.200.0050.03212.74
5.3.190.0030.02512.75
5.3.180.0020.02312.74
5.3.170.0030.02712.76
5.3.160.0050.02612.80
5.3.150.0020.02412.78
5.3.140.0030.03612.79
5.3.130.0030.02212.78
5.3.120.0060.04012.72
5.3.110.0050.03212.72
5.3.100.0090.02212.53
5.3.90.0020.02912.46
5.3.80.0050.03012.52
5.3.70.0000.02812.47
5.3.60.0000.02712.41
5.3.50.0050.02812.44
5.3.40.0050.02112.49
5.3.30.0050.03112.45
5.3.20.0070.01712.26
5.3.10.0050.02012.31
5.3.00.0050.01912.21
5.2.170.0020.03711.03
5.2.160.0020.02011.18
5.2.150.0020.02811.10
5.2.140.0020.01911.14
5.2.130.0030.02011.08
5.2.120.0070.01511.06
5.2.110.0000.02111.13
5.2.100.0030.02511.05
5.2.90.0020.01911.03
5.2.80.0080.01511.02
5.2.70.0050.02311.08
5.2.60.0030.02311.09
5.2.50.0040.02411.02
5.2.40.0060.03511.05
5.2.30.0050.01911.05
5.2.20.0050.01610.94
5.2.10.0040.02010.91
5.2.00.0050.02310.93
5.1.60.0050.01610.57
5.1.50.0020.02110.57
5.1.40.0050.01810.47
5.1.30.0000.02110.78
5.1.20.0040.01510.69
5.1.10.0000.01710.55
5.1.00.0040.01510.60
5.0.50.0050.01310.34
5.0.40.0020.01510.34
5.0.30.0030.02010.34
5.0.20.0040.01910.34
5.0.10.0060.01310.34
5.0.00.0010.02010.34
4.4.90.0020.01510.34
4.4.80.0030.01310.34
4.4.70.0020.00810.34
4.4.60.0020.01310.34
4.4.50.0030.01510.34
4.4.40.0030.01510.34
4.4.30.0010.01510.34
4.4.20.0010.01310.34
4.4.10.0020.01110.34
4.4.00.0020.02310.34
4.3.110.0020.01210.34
4.3.100.0000.01210.34
4.3.90.0030.01510.34
4.3.80.0000.02610.34
4.3.70.0020.01910.34
4.3.60.0000.01610.34
4.3.50.0020.01610.34
4.3.40.0020.01810.34
4.3.30.0020.01910.34
4.3.20.0020.01510.34
4.3.10.0000.01010.34
4.3.00.0000.01210.34

preferences:
40.96 ms | 400 KiB | 5 Q