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);
Output for git.master, git.master_jit, rfc.property-hooks
6.11 GB

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
25.34 ms | 401 KiB | 8 Q