3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fm_get_filesize($size) { $size = (float) $size; $size = (int) $size; $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); $power = $size > 0 ? floor(log($size, 1024)) : 0; return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]); $i = 0; while (($size / 1024) > 0.9) { $size = $size / 1024; $i++; } // Fix 32bit integer overflow $int_max = defined('PHP_INT_MAX') ? PHP_INT_MAX : ((strlen(decbin(~0)) === 32) ? 2147483647 : 9223372036854775807); $size = ($size < 0) ? ($size + (2.0 * ($int_max + 1))) : $size; return round($size, 2).' '.$units[$i]; } echo fm_get_filesize(6565655656);

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.0110.00418.43
8.3.50.0040.01120.34
8.3.40.0060.00919.14
8.3.30.0110.00418.89
8.3.20.0060.00324.18
8.3.10.0000.00824.66
8.3.00.0080.00026.16
8.2.180.0140.00325.92
8.2.170.0100.00618.96
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00326.16
8.2.110.0070.00420.85
8.2.100.0100.00019.27
8.1.280.0090.00925.92
8.1.270.0040.00424.10
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0100.00018.86
8.1.230.0090.00518.92
5.0.00.0020.00210.41

preferences:
33.49 ms | 400 KiB | 5 Q