<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Code (PHP): filesizeFormatted()</title>
	<atom:link href="http://workshop.evolutionzone.com/2006/10/27/code-php-filesizeformatted/feed/" rel="self" type="application/rss+xml" />
	<link>http://workshop.evolutionzone.com/2006/10/27/code-php-filesizeformatted/</link>
	<description>Computational aesthetics and programming for artists and designers.</description>
	<lastBuildDate>Tue, 31 Jan 2012 05:39:21 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Ryan the Fish Scale</title>
		<link>http://workshop.evolutionzone.com/2006/10/27/code-php-filesizeformatted/comment-page-1/#comment-1169</link>
		<dc:creator>Ryan the Fish Scale</dc:creator>
		<pubDate>Tue, 31 Oct 2006 20:53:48 +0000</pubDate>
		<guid isPermaLink="false">http://workshop.evolutionzone.com/2006/10/27/code-php-filesizeformatted/#comment-1169</guid>
		<description>Oh weird I guess it doesnt like the lessthan symbol. I&#039;ll try again.

&lt;code lang=&quot;php&quot;&gt;function formatsize($size) 
{
	$kb = 1024;        // Kilobyte
	$mb = 1024 * $kb;  // Megabyte
	$gb = 1024 * $mb;  // Gigabyte
	$tb = 1024 * $gb;  // Terabyte
	if($size == 0) { return &#039;empty&#039;; }
	if($size &lt; $kb) { return $size.&#039; bytes&#039;; }
	else if($size &lt; $mb) { return round($size/$kb,2).&#039; kb&#039;; }
	else if($size &lt; $gb) { return round($size/$mb,2).&#039; mb&#039;; }
	else if($size &lt; $tb) { return round($size/$gb,2).&#039; gb&#039;; }
	else { return round($size/$tb,2).&#039; tb&#039;; }
}&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Oh weird I guess it doesnt like the lessthan symbol. I&#8217;ll try again.</p>
<p><code lang="php">function formatsize($size)<br />
{<br />
	$kb = 1024;        // Kilobyte<br />
	$mb = 1024 * $kb;  // Megabyte<br />
	$gb = 1024 * $mb;  // Gigabyte<br />
	$tb = 1024 * $gb;  // Terabyte<br />
	if($size == 0) { return 'empty'; }<br />
	if($size < $kb) { return $size.' bytes'; }<br />
	else if($size < $mb) { return round($size/$kb,2).' kb'; }<br />
	else if($size < $gb) { return round($size/$mb,2).' mb'; }<br />
	else if($size < $tb) { return round($size/$gb,2).' gb'; }<br />
	else { return round($size/$tb,2).' tb'; }<br />
}</code></code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

