<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.8.6" -->
<rss version="0.92">
<channel>
	<title>Coder Snippets</title>
	<link>http://codersnippets.com</link>
	<description>Useful tips and snippets I find or come up with.</description>
	<lastBuildDate>Fri, 04 Dec 2009 16:53:42 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>Array to JSON function</title>
		<description>
/**
 * Converts an associative array of arbitrary depth and dimension into JSON representation.
 *
 * NOTE: If you pass in a mixed associative and vector array, it will prefix each numerical
 * key with "key_". For example array("foo", "bar" => "baz") will be translated into
 * {'key_0': 'foo', 'bar': ...</description>
		<link>http://codersnippets.com/uncategorized/array-to-json-function/</link>
			</item>
	<item>
		<title>Define an array of data with PHP and JSON</title>
		<description>Something I've always wanted was a way to store an array of data within a PHP define variable. 

The only solution I've come up with for this is to store JSON text in the define then decode it into an array when the data is needed.

My example will store some ...</description>
		<link>http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/</link>
			</item>
	<item>
		<title>Return readable filesize</title>
		<description>
	function get_file_size($filename, $size_in = 'MB')
	{
		$size_in_bytes = filesize($filename);
				
		if($size_in == 'B')
		{
			$size = $size_in_bytes;
			$precision = 0;
		}
		elseif($size_in == 'KB')
		{
			$size = (($size_in_bytes / 1024));
			$precision = 2;
		}
		elseif($size_in == 'MB')
		{
			$size = (($size_in_bytes / 1024) / 1024);
			$precision = 2;
		}
		elseif($size_in == 'GB')
		{
			$size = (($size_in_bytes / 1024) / 1024) / 1024;
			$precision = 2;
		}
		
		$size = round($size, $precision);
	
		return $size.' '.$size_in;
	}
 </description>
		<link>http://codersnippets.com/web/return-readable-filesize/</link>
			</item>
	<item>
		<title>Outline web page structure with CSS</title>
		<description>
* { outline: 2px dotted red }
* * { outline: 2px dotted green }
* * * { outline: 2px dotted orange }
* * * * { outline: 2px dotted blue }
* * * * * { outline: 1px solid red }
* * * * * * { outline: 1px solid ...</description>
		<link>http://codersnippets.com/web/outline-web-page-structure-with-css/</link>
			</item>
	<item>
		<title>PHP Snippet</title>
		<description>
	switch ($aReturn) 
	{
		case 'CSV':
			return substr_replace($aContent ,"",-1);
			break;
		
		case 'Array':
			return $aSuperGroupLinkArray;
			break;
			
		case 'Error';
			return $aErrorContent;
			break;
			
		default;
			return $aErrorContent;
			break;
	}
 </description>
		<link>http://codersnippets.com/web/hello-world/</link>
			</item>
</channel>
</rss>
