note 112996 added to function.filesize

From: Date: Fri, 16 Aug 2013 10:51:05 +0000
Subject: note 112996 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-195985@lists.php.net to get a copy of this message
<?php /** * Converts bytes into human readable file size. * * @param string $bytes * @return string human readable file size (2,87 Мб) * @author Mogilev Arseny */ function FileSizeConvert($bytes) { $bytes = floatval($bytes); $arBytes = array( 0 => array( "UNIT" => "TB", "VALUE" => pow(1024, 4) ), 1 => array( "UNIT" => "GB", "VALUE" => pow(1024, 3) ), 2 => array( "UNIT" => "MB", "VALUE" => pow(1024, 2) ), 3 => array( "UNIT" => "KB", "VALUE" => 1024 ), 4 => array( "UNIT" => "B", "VALUE" => 1 ), ); foreach($arBytes as $arItem) { if($bytes >= $arItem["VALUE"]) { $result = $bytes / $arItem["VALUE"]; $result = str_replace(".", "," , strval(round($result, 2)))." ".$arItem["UNIT"]; break; } } return $result; } ?> ---- Server IP: 69.147.83.199 Probable Submitter: 212.232.58.235 ---- Manual Page -- http://php.net/manual/en/function.filesize.php Edit -- https://master.php.net/note/edit/112996 Del: integrated -- https://master.php.net/note/delete/112996/integrated Del: useless -- https://master.php.net/note/delete/112996/useless Del: bad code -- https://master.php.net/note/delete/112996/bad+code Del: spam -- https://master.php.net/note/delete/112996/spam Del: non-english -- https://master.php.net/note/delete/112996/non-english Del: in docs -- https://master.php.net/note/delete/112996/in+docs Del: other reasons-- https://master.php.net/note/delete/112996 Reject -- https://master.php.net/note/reject/112996 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195985) next »