note 112995 added to function.filesize

From: Date: Fri, 16 Aug 2013 10:47:19 +0000
Subject: note 112995 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-195984@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" => "Тб", "VALUE" => pow(1024, 4) ), 1 => array( "UNIT" => "Гб", "VALUE" => pow(1024, 3) ), 2 => array( "UNIT" => "Мб", "VALUE" => pow(1024, 2) ), 3 => array( "UNIT" => "Кб", "VALUE" => 1024 ), 4 => array( "UNIT" => "Б", "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/112995 Del: integrated -- https://master.php.net/note/delete/112995/integrated Del: useless -- https://master.php.net/note/delete/112995/useless Del: bad code -- https://master.php.net/note/delete/112995/bad+code Del: spam -- https://master.php.net/note/delete/112995/spam Del: non-english -- https://master.php.net/note/delete/112995/non-english Del: in docs -- https://master.php.net/note/delete/112995/in+docs Del: other reasons-- https://master.php.net/note/delete/112995 Reject -- https://master.php.net/note/reject/112995 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195984) next »