svn: /web/php-windows/trunk/include/ tools.php

From: Date: Sat, 30 Apr 2011 13:56:36 +0000
Subject: svn: /web/php-windows/trunk/include/ tools.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-10932@lists.php.net to get a copy of this message
pajoye Sat, 30 Apr 2011 13:56:36 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=310662 Log: - initial import Changed paths: A web/php-windows/trunk/include/tools.php Added: web/php-windows/trunk/include/tools.php =================================================================== --- web/php-windows/trunk/include/tools.php (rev 0) +++ web/php-windows/trunk/include/tools.php 2011-04-30 13:56:36 UTC (rev 310662) @@ -0,0 +1,9 @@ +<?php +function bytes2string($size, $precision = 2) { + $sizes = array('YB', 'ZB', 'EB', 'PB', 'TB', 'GB', 'MB', 'kB', 'B'); + $total = count($sizes); + + while($total-- && $size > 1024) $size /= 1024; + + return round($size, $precision).$sizes[$total]; +}

« previous php.webmaster (#10932) next »