<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coder Snippets</title>
	<atom:link href="http://codersnippets.com/feed/" rel="self" type="application/rss+xml" />
	<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>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Array to JSON function</title>
		<link>http://codersnippets.com/uncategorized/array-to-json-function/</link>
		<comments>http://codersnippets.com/uncategorized/array-to-json-function/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 16:53:42 +0000</pubDate>
		<dc:creator>Sirbastian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codersnippets.com/uncategorized/array-to-json-function/</guid>
		<description><![CDATA[
/**
 * 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': 'baz'} but array("foo", "bar") would [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: php">
/**
 * 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': 'baz'} but array("foo", "bar") would be translated into [ 'foo', 'bar' ].
 *
 * @param $array The array to convert.
 * @return mixed The resulting JSON string, or false if the argument was not an array.
 * @author Andy Rusterholz
 */
function array_to_json( $array ){

    if( !is_array( $array ) ){
        return false;
    }

    $associative = count( array_diff( array_keys($array), array_keys( array_keys( $array )) ));
    if( $associative ){

        $construct = array();
        foreach( $array as $key => $value ){

            // We first copy each key/value pair into a staging array,
            // formatting each key and value properly as we go.

            // Format the key:
            if( is_numeric($key) ){
                $key = "key_$key";
            }
            $key = "'".addslashes($key)."'";

            // Format the value:
            if( is_array( $value )){
                $value = array_to_json( $value );
            } else if( !is_numeric( $value ) || is_string( $value ) ){
                $value = "'".addslashes($value)."'";
            }

            // Add to staging array:
            $construct[] = "$key: $value";
        }

        // Then we collapse the staging array into the JSON form:
        $result = "{ " . implode( ", ", $construct ) . " }";

    } else { // If the array is a vector (not associative):

        $construct = array();
        foreach( $array as $value ){

            // Format the value:
            if( is_array( $value )){
                $value = array_to_json( $value );
            } else if( !is_numeric( $value ) || is_string( $value ) ){
                $value = "'".addslashes($value)."'";
            }

            // Add to staging array:
            $construct[] = $value;
        }

        // Then we collapse the staging array into the JSON form:
        $result = "[ " . implode( ", ", $construct ) . " ]";
    }

    return $result;
}
</pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d49').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d49" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://codersnippets.com/uncategorized/array-to-json-function/&amp;submitHeadline=Array+to+JSON+function&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://codersnippets.com/uncategorized/array-to-json-function/&amp;title=Array+to+JSON+function" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://codersnippets.com/uncategorized/array-to-json-function/&amp;title=Array+to+JSON+function" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://codersnippets.com/uncategorized/array-to-json-function/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://codersnippets.com/uncategorized/array-to-json-function/&amp;title=Array+to+JSON+function" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://codersnippets.com/uncategorized/array-to-json-function/&amp;title=Array+to+JSON+function" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://codersnippets.com/uncategorized/array-to-json-function/&amp;title=Array+to+JSON+function" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://codersnippets.com/uncategorized/array-to-json-function/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://codersnippets.com/uncategorized/array-to-json-function/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Array+to+JSON+function+@+http://codersnippets.com/uncategorized/array-to-json-function/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://codersnippets.com/uncategorized/array-to-json-function/&amp;t=Array+to+JSON+function" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d49').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://codersnippets.com/uncategorized/array-to-json-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Define an array of data with PHP and JSON</title>
		<link>http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/</link>
		<comments>http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 00:08:13 +0000</pubDate>
		<dc:creator>Sirbastian</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://codersnippets.com/code/?p=32</guid>
		<description><![CDATA[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 settings used to connect to [...]]]></description>
			<content:encoded><![CDATA[<p>Something I've always wanted was a way to store an array of data within a PHP define variable. </p>
<p>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.</p>
<p>My example will store some settings used to connect to a database.</p>
<p>Firstly you've got to define DBCONFIG using JSON</p>
<pre class="brush: php">
     define('DBCONFIG', '{"aDbHost":"localhost","aDbUser":"root","aDbPass":"hello1","aDbName":"mydatabase","debugging":"false"}');
</pre>
<p>Load the JSON into an array using:</p>
<pre class="brush: php">
     $aConfigArray = json_decode(DBCONFIG, true);
     // true tells the function to return an array not an object
</pre>
<p>Now you can extract the array into seperate variables.</p>
<pre class="brush: php">
     extract($aConfigArray);
</pre>
<p>Once you've extracted all of the variables you can use them however you need.</p>
<pre class="brush: php">
$aDb = mysql_connect($aDbHost, $aDbUSer,  $aDbPass);
mysql_select_db($aDbName);
</pre>
<p>or</p>
<pre class="brush: php">
print 'Host: '. $aDbHost;
print 'User: '. $aDbUser;
print 'Pass: '. $aDbPass;
print 'DB Name: '. $aDbName;
</pre>
<p>Outputs:<br />
Host: localhost<br />
User: root<br />
Pass: hello1<br />
DB Name: mydatabase</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d32').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d32" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;submitHeadline=Define+an+array+of+data+with+PHP+and+JSON&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;title=Define+an+array+of+data+with+PHP+and+JSON" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;title=Define+an+array+of+data+with+PHP+and+JSON" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;title=Define+an+array+of+data+with+PHP+and+JSON" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;title=Define+an+array+of+data+with+PHP+and+JSON" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;title=Define+an+array+of+data+with+PHP+and+JSON" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Define+an+array+of+data+with+PHP+and+JSON+@+http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/&amp;t=Define+an+array+of+data+with+PHP+and+JSON" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d32').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://codersnippets.com/web/define-an-array-of-data-with-php-and-json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Return readable filesize</title>
		<link>http://codersnippets.com/web/return-readable-filesize/</link>
		<comments>http://codersnippets.com/web/return-readable-filesize/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 10:16:43 +0000</pubDate>
		<dc:creator>Sirbastian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://codersnippets.com/code/?p=23</guid>
		<description><![CDATA[
	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;
	}



Bookmark this post















Hide Sites



]]></description>
			<content:encoded><![CDATA[<pre class="brush: php">
	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;
	}
</pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d23').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d23" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://codersnippets.com/web/return-readable-filesize/&amp;submitHeadline=Return+readable+filesize&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://codersnippets.com/web/return-readable-filesize/&amp;title=Return+readable+filesize" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://codersnippets.com/web/return-readable-filesize/&amp;title=Return+readable+filesize" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://codersnippets.com/web/return-readable-filesize/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://codersnippets.com/web/return-readable-filesize/&amp;title=Return+readable+filesize" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://codersnippets.com/web/return-readable-filesize/&amp;title=Return+readable+filesize" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://codersnippets.com/web/return-readable-filesize/&amp;title=Return+readable+filesize" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://codersnippets.com/web/return-readable-filesize/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://codersnippets.com/web/return-readable-filesize/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Return+readable+filesize+@+http://codersnippets.com/web/return-readable-filesize/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://codersnippets.com/web/return-readable-filesize/&amp;t=Return+readable+filesize" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d23').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://codersnippets.com/web/return-readable-filesize/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outline web page structure with CSS</title>
		<link>http://codersnippets.com/web/outline-web-page-structure-with-css/</link>
		<comments>http://codersnippets.com/web/outline-web-page-structure-with-css/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 06:50:58 +0000</pubDate>
		<dc:creator>Sirbastian</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://codersnippets.com/code/?p=20</guid>
		<description><![CDATA[Useful snippet to show the structure of a webpage.]]></description>
			<content:encoded><![CDATA[<pre class="brush: css">
* { outline: 2px dotted red }
* * { outline: 2px dotted green }
* * * { outline: 2px dotted orange }
* * * * { outline: 2px dotted blue }
* * * * * { outline: 1px solid red }
* * * * * * { outline: 1px solid green }
* * * * * * * { outline: 1px solid orange }
* * * * * * * * { outline: 1px solid blue }
</pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d20').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d20" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;submitHeadline=Outline+web+page+structure+with+CSS&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;title=Outline+web+page+structure+with+CSS" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;title=Outline+web+page+structure+with+CSS" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://codersnippets.com/web/outline-web-page-structure-with-css/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;title=Outline+web+page+structure+with+CSS" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;title=Outline+web+page+structure+with+CSS" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;title=Outline+web+page+structure+with+CSS" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://codersnippets.com/web/outline-web-page-structure-with-css/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://codersnippets.com/web/outline-web-page-structure-with-css/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Outline+web+page+structure+with+CSS+@+http://codersnippets.com/web/outline-web-page-structure-with-css/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://codersnippets.com/web/outline-web-page-structure-with-css/&amp;t=Outline+web+page+structure+with+CSS" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d20').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://codersnippets.com/web/outline-web-page-structure-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Snippet</title>
		<link>http://codersnippets.com/web/hello-world/</link>
		<comments>http://codersnippets.com/web/hello-world/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 08:51:01 +0000</pubDate>
		<dc:creator>Sirbastian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://codersnippet.com/code/?p=1</guid>
		<description><![CDATA[Code to select all groups]]></description>
			<content:encoded><![CDATA[<pre class="brush: php">
	switch ($aReturn)
	{
		case 'CSV':
			return substr_replace($aContent ,"",-1);
			break;

		case 'Array':
			return $aSuperGroupLinkArray;
			break;

		case 'Error';
			return $aErrorContent;
			break;

		default;
			return $aErrorContent;
			break;
	}
</pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d1').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d1" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://codersnippets.com/web/hello-world/&amp;submitHeadline=PHP+Snippet&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://codersnippets.com/web/hello-world/&amp;title=PHP+Snippet" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://codersnippets.com/web/hello-world/&amp;title=PHP+Snippet" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://codersnippets.com/web/hello-world/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://codersnippets.com/web/hello-world/&amp;title=PHP+Snippet" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://codersnippets.com/web/hello-world/&amp;title=PHP+Snippet" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://codersnippets.com/web/hello-world/&amp;title=PHP+Snippet" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://codersnippets.com/web/hello-world/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://codersnippets.com/web/hello-world/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+PHP+Snippet+@+http://codersnippets.com/web/hello-world/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://codersnippets.com/web/hello-world/&amp;t=PHP+Snippet" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://codersnippets.com/code/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d1').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://codersnippets.com/web/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
