3v4l.org

run code in 300+ PHP versions simultaneously
<?php function human_filesize($size,$unit="") { if( (!$unit && $size >= 1<<30) || $unit == "GB") return number_format($size/(1<<30),2)."GB"; if( (!$unit && $size >= 1<<20) || $unit == "MB") return number_format($size/(1<<20),2)."MB"; if( (!$unit && $size >= 1<<10) || $unit == "KB") return number_format($size/(1<<10),2)."KB"; return number_format($size)." bytes"; } $start = microtime(true); for($i=0;$i<10000;$i++) human_filesize(123456789); echo microtime(true) - $start . PHP_EOL;

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)
7.2.00.0000.01919.47
7.1.70.0070.01117.30
7.1.60.0070.01519.43
7.1.50.0030.02716.69
7.1.00.0030.08322.46
7.0.200.0030.00816.79
7.0.60.0000.09719.87
7.0.50.0170.07717.91
7.0.40.0200.03320.13
7.0.30.0130.05320.18
7.0.20.0300.06020.33
7.0.10.0270.06720.08
7.0.00.0130.08720.16
5.6.280.0030.04021.13
5.6.210.0030.09320.57
5.6.200.0000.09718.19
5.6.190.0100.06320.61
5.6.180.0070.07020.56
5.6.170.0200.05720.59
5.6.160.0030.09720.62
5.6.150.0070.05718.19
5.6.140.0130.08018.23
5.6.130.0100.06018.15
5.6.120.0100.09321.13
5.6.110.0030.07721.14
5.6.100.0070.09020.98
5.6.90.0100.07021.12
5.6.80.0130.08320.51
5.6.70.3400.04320.50
5.5.350.0100.08720.39
5.5.340.0130.08017.98
5.5.330.0170.04320.36
5.5.320.0070.09720.30
5.5.310.0330.06020.42
5.5.300.0030.10017.92
5.5.290.0030.04717.99
5.5.280.0030.09320.98
5.5.270.0000.07320.84
5.5.260.0030.05720.84
5.5.250.0100.08020.71
5.5.240.0100.04020.18
5.4.450.0730.06719.45
5.4.440.0700.06019.51
5.4.430.0600.07319.35
5.4.420.0700.06019.38
5.4.410.0700.07719.23
5.4.400.0600.07019.04
5.4.390.0870.07318.83
5.4.380.0600.07019.33
5.4.370.0630.06719.04
5.4.360.0630.08319.02
5.4.350.0570.07019.08
5.4.340.0600.07719.18
5.4.320.0670.06719.20
5.4.310.0630.06318.91
5.4.300.0630.06719.29
5.4.290.0700.06019.30
5.4.280.0370.08019.02
5.4.270.0130.06319.08
5.4.260.0100.06719.30
5.4.250.0530.07018.83
5.4.240.0770.07719.19
5.4.230.0630.06719.09
5.4.220.0530.07019.05
5.4.210.0600.06319.19
5.4.200.0530.07319.22
5.4.190.0730.07719.36
5.4.180.0270.06019.32
5.4.170.0200.10318.82
5.4.160.0200.05719.06
5.4.150.0070.07319.31
5.4.140.0200.07716.40
5.4.130.0270.08316.39
5.4.120.0330.05716.41
5.4.110.0370.07716.53
5.4.100.0230.05316.61
5.4.90.0300.05016.55
5.4.80.0170.05716.48
5.4.70.0170.06016.46
5.4.60.0170.06016.56
5.4.50.0300.05716.60
5.4.40.0170.06316.59
5.4.30.0370.04716.55
5.4.20.0270.05716.58
5.4.10.0130.07016.43
5.4.00.0130.06315.85

preferences:
32.62 ms | 403 KiB | 5 Q