3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$amount = number_format(9.22337203685E+18,0,'',''); $amount = 223372036849999872; $number_sep = array(); $multi = 1; $exit = false; $i = 1000; for($j=3;$j < 15 ;$j=$j+2) { switch($j) { case 3: $temp = ($amount/$i);echo $temp;$temp = round(($temp - floor($temp)) * 1000,2); if($i < $amount) { if(!$temp) { $number_sep[] = '000'; } else { $amount = $amount - $temp; $number_sep[] = str_pad(round($temp,2),3,'0',STR_PAD_LEFT); } } else { if(!$temp) { $number_sep[] = '000'; } else { $number_sep[] = str_pad(round($temp,2),3,'0',STR_PAD_LEFT); } $exit = true; } break; case $j > 3 : $temp = $amount % $i; if($i < $amount) { if(!$temp) { $number_sep[] = '00'; } else { $amount = $amount - $temp; echo $temp; $number_sep[] = round($temp/($i/100),0); } } else { if(!$temp) { $number_sep[] = '00'; } else { $number_sep[] = round($temp/($i/100),0); } $exit = true; }; break; } print_r($number_sep); if($exit) { break; } $i = 10 * 10 * $i; } echo implode(',',array_reverse($number_sep));

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.0030.01016.50
8.3.50.0120.00716.61
8.3.40.0150.00618.84
8.3.30.0090.00918.71
8.3.20.0080.00018.85
8.3.10.0060.00320.48
8.3.00.0080.00019.50
8.2.180.0040.01216.63
8.2.170.0070.01122.96
8.2.160.0030.01021.01
8.2.150.0030.00524.18
8.2.140.0110.00424.66
8.2.130.0120.00326.16
8.2.120.0050.00319.48
8.2.110.0060.00322.25
8.2.100.0000.01220.48
8.2.90.0000.00918.34
8.2.80.0030.00618.02
8.2.70.0040.00418.16
8.2.60.0000.00817.93
8.2.50.0000.00818.10
8.2.40.0040.00418.34
8.2.30.0040.00418.27
8.2.20.0060.00317.68
8.2.10.0040.00417.74
8.2.00.0060.00617.81
8.1.280.0070.01425.92
8.1.270.0000.00824.66
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0030.00624.05
8.1.230.0120.00019.22
8.1.220.0040.00417.78
8.1.210.0060.00318.77
8.1.200.0040.00717.23
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0040.00418.80
8.1.160.0000.00718.89
8.1.150.0040.00418.71
8.1.140.0000.01017.49
8.1.130.0030.00317.96
8.1.120.0050.00317.60
8.1.110.0040.00417.45
8.1.100.0070.00017.54
8.1.90.0070.00017.61
8.1.80.0070.00017.46
8.1.70.0070.00017.51
8.1.60.0070.00317.67
8.1.50.0050.00317.55
8.1.40.0040.00417.61
8.1.30.0030.00617.68
8.1.20.0040.00417.75
8.1.10.0000.00817.59
8.1.00.0040.00417.39
8.0.300.0070.00019.61
8.0.290.0070.00016.75
8.0.280.0030.00518.52
8.0.270.0050.00217.29
8.0.260.0000.00716.85
8.0.250.0000.00717.05
8.0.240.0040.00417.00
8.0.230.0050.00316.97
8.0.220.0050.00216.96
8.0.210.0030.00317.00
8.0.200.0040.00417.03
8.0.190.0040.00417.02
8.0.180.0050.00216.94
8.0.170.0040.00417.00
8.0.160.0040.00417.05
8.0.150.0030.00617.00
8.0.140.0050.00316.98
8.0.130.0060.00313.38
8.0.120.0040.00416.91
8.0.110.0030.00317.02
8.0.100.0000.00716.97
8.0.90.0050.00317.04
8.0.80.0100.01316.90
8.0.70.0050.00317.00
8.0.60.0000.00817.00
8.0.50.0040.00416.86
8.0.30.0080.01017.04
8.0.20.0070.01117.00
8.0.10.0000.00816.91
8.0.00.0130.00716.76
7.4.330.0000.00513.09
7.4.320.0050.00516.61
7.4.300.0000.00616.63
7.4.290.0080.00016.54
7.4.280.0060.00316.66
7.4.270.0040.00416.60
7.4.260.0000.00613.48
7.4.250.0040.00416.74
7.4.240.0000.00716.63
7.4.230.0020.00516.74
7.4.220.0030.01516.63
7.4.210.0030.01116.69
7.4.200.0000.00716.57
7.4.190.0040.00416.77
7.4.160.0090.00616.55
7.4.150.0030.01316.61
7.4.140.0180.00516.61
7.4.130.0080.01116.66
7.4.120.0100.00716.80
7.4.110.0100.00616.66
7.4.100.0140.00416.58
7.4.90.0070.01416.58
7.4.80.0110.01119.39
7.4.70.0100.00716.75
7.4.60.0110.00716.58
7.4.50.0000.00916.66
7.4.40.0070.00316.69
7.4.30.0040.01216.48
7.4.00.0040.01114.78
7.3.330.0060.00013.23
7.3.320.0050.00013.28
7.3.310.0040.00416.23
7.3.300.0030.00416.26
7.3.290.0180.00416.47
7.3.280.0100.00616.41
7.3.270.0130.01016.57
7.3.260.0070.01116.66
7.3.250.0060.01316.54
7.3.240.0140.00416.32
7.3.230.0080.01116.57
7.3.210.0080.00816.54
7.3.200.0060.01316.61
7.3.190.0100.00716.68
7.3.180.0130.00316.50
7.3.170.0170.00316.65
7.3.160.0090.00616.52
7.3.120.0070.01014.73
7.2.330.0070.01016.70
7.2.320.0100.01016.86
7.2.310.0170.00716.53
7.2.300.0100.00716.59
7.2.290.0100.00616.81
7.2.00.0030.01019.51
7.1.100.0030.00918.24
7.1.70.0080.00017.13
7.1.60.0090.01319.40
7.1.50.0090.01217.02
7.1.00.0030.07322.45
7.0.200.0030.00716.72
7.0.140.0030.07322.09
7.0.120.0000.06722.05
7.0.60.0030.06721.82
7.0.50.0070.06317.88
7.0.40.0000.04720.14
7.0.30.0530.03020.12
7.0.20.0230.06720.23
7.0.10.0230.05020.06
7.0.00.0070.08320.24
5.6.280.0030.07721.09
5.6.210.0070.03720.55
5.6.200.0030.08018.27
5.6.190.0030.09320.38
5.6.180.0270.04320.63
5.6.170.0270.05020.68
5.6.160.0070.03720.61
5.6.150.0030.04018.18
5.6.140.0100.08018.18
5.6.130.0070.06318.23
5.6.120.0100.07320.98
5.6.110.0100.08021.05
5.6.100.0100.08020.98
5.6.90.0170.04020.99
5.6.80.0100.06320.36
5.5.350.0000.05720.41
5.5.340.0130.07317.95
5.5.330.0070.06020.42
5.5.320.0100.06320.33
5.5.310.0300.07320.24
5.5.300.0100.07717.95
5.5.290.0130.08018.01
5.5.280.0170.07320.87
5.5.270.0030.06020.96
5.5.260.0070.06320.87
5.5.250.0070.07020.66
5.5.240.0100.02320.27
5.4.450.0030.05019.53
5.4.440.0070.08019.18
5.4.430.0100.06019.48
5.4.420.0070.06319.47
5.4.410.0170.03319.44
5.4.400.0100.07018.92
5.4.390.0070.04018.85
5.4.380.0130.07718.85
5.4.370.0130.05319.24
5.4.360.0270.06718.87
5.4.350.0130.06719.18
5.4.340.0100.08319.06
5.4.320.0030.05719.14
5.4.310.0030.04319.23
5.4.300.0070.04319.14
5.4.290.0000.04318.87
5.4.280.0070.04718.87
5.4.270.0070.07018.84
5.4.260.0030.04719.21
5.4.250.0030.08319.21
5.4.240.0030.05719.14
5.4.230.0070.07719.16
5.4.220.0000.04718.85
5.4.210.0130.07019.14
5.4.200.0100.07719.23
5.4.190.0100.07719.23
5.4.180.0000.07319.14
5.4.170.0170.06018.86
5.4.160.0100.04319.19
5.4.150.0030.07719.12
5.4.140.0130.07016.50
5.4.130.0030.05316.34
5.4.120.0030.04016.58
5.4.110.0100.07016.53
5.4.100.0070.05016.41
5.4.90.0030.06316.45
5.4.80.0070.04016.39
5.4.70.0000.04316.38
5.4.60.0070.07016.45
5.4.50.0070.07316.37
5.4.40.0030.05016.25
5.4.30.0030.03716.26
5.4.20.0000.06316.38
5.4.10.0100.06716.46
5.4.00.0070.07715.86
5.3.290.0030.07314.68
5.3.280.0070.04314.60
5.3.270.0070.03714.73
5.3.260.0200.06714.66
5.3.250.0100.07714.52
5.3.240.0030.04714.63
5.3.230.0200.06314.66
5.3.220.0030.07714.75
5.3.210.0130.07014.73
5.3.200.0130.06714.67
5.3.190.0000.06714.67
5.3.180.0070.06314.57
5.3.170.0130.05714.59
5.3.160.0070.08714.58
5.3.150.0100.04314.59
5.3.140.0000.05714.57
5.3.130.0070.03714.65
5.3.120.0030.04314.62
5.3.110.0100.07714.65
5.3.100.0100.06714.06
5.3.90.0070.07714.18
5.3.80.0030.05014.08
5.3.70.0030.08014.01
5.3.60.0070.07714.07
5.3.50.0070.06714.01
5.3.40.0030.06714.11
5.3.30.0130.07013.94
5.3.20.0030.05313.72
5.3.10.0030.03313.71
5.3.00.0070.03313.65
5.2.170.0030.03711.20
5.2.160.0030.06311.28
5.2.150.0000.06011.25
5.2.140.0030.05011.38
5.2.130.0030.03011.39
5.2.120.0030.03011.16
5.2.110.0070.02311.16
5.2.100.0000.03011.25
5.2.90.0100.02711.25
5.2.80.0000.03711.23
5.2.70.0000.04311.28
5.2.60.0000.03011.15
5.2.50.0030.02711.22
5.2.40.0070.02311.23
5.2.30.0030.02711.18
5.2.20.0070.02311.09
5.2.10.0000.03011.14
5.2.00.0030.02710.86
5.1.60.0000.02310.08
5.1.50.0000.03010.28
5.1.40.0000.02310.25
5.1.30.0030.02310.59
5.1.20.0030.02310.48
5.1.10.0030.02310.31
5.1.00.0030.02710.20
5.0.50.0030.0208.84
5.0.40.0030.0178.59
5.0.30.0030.0278.51
5.0.20.0000.0208.34
5.0.10.0000.0208.46
5.0.00.0000.0308.41
4.4.90.0030.0138.34
4.4.80.0000.0178.34
4.4.70.0000.0178.34
4.4.60.0030.0138.34
4.4.50.0030.0138.34
4.4.40.0000.0238.34
4.4.30.0000.0178.34
4.4.20.0000.0178.34
4.4.10.0030.0138.34
4.4.00.0000.0278.34
4.3.110.0070.0108.34
4.3.100.0000.0138.34
4.3.90.0000.0178.34
4.3.80.0030.0338.34
4.3.70.0030.0138.34
4.3.60.0000.0178.34
4.3.50.0000.0178.34
4.3.40.0030.0238.34
4.3.30.0000.0178.34
4.3.20.0000.0138.34
4.3.10.0000.0138.34
4.3.00.0000.0138.34

preferences:
35.68 ms | 401 KiB | 5 Q