<?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>Dazzle Software &#187; JavaScript</title>
	<atom:link href="http://blog.dazzlecms.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dazzlecms.com</link>
	<description>The net&#039;s largest script collection and resource web portal</description>
	<lastBuildDate>Sat, 26 Nov 2011 12:13:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Preferred method to store PHP arrays (json_encode vs serialize)</title>
		<link>http://blog.dazzlecms.com/programming/php/preferred-method-to-store-php-arrays-json_encode-vs-serialize/</link>
		<comments>http://blog.dazzlecms.com/programming/php/preferred-method-to-store-php-arrays-json_encode-vs-serialize/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 00:12:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[associative]]></category>
		<category><![CDATA[decode]]></category>
		<category><![CDATA[Encoding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[unserialize]]></category>

		<guid isPermaLink="false">http://blog.dazzlecms.com/?p=7</guid>
		<description><![CDATA[I need to store a multi-dimensional associative array of data in a flat file for caching purposes. I might occasionally come across the need to convert it to JSON for use in my web app but the vast majority of the time I will be using the array directly in PHP. Would it be more [...]]]></description>
			<content:encoded><![CDATA[<p>I need to store a multi-dimensional associative array of data in a flat file for caching purposes. I might occasionally come across the need to convert it to JSON for use in my web app but the vast majority of the time I will be using the array directly in PHP.</p>
<p>Would it be more efficient to store the array as JSON or as a PHP serialized array in this text file? I&#8217;ve looked around and it seems that in the newest versions of PHP (5.3), <code>json_decode</code> is actually faster than <code>unserialize</code>.</p>
<p>I&#8217;m currently leaning towards storing the array as JSON as I feel its easier to read by a human if necessary, it can be used in both PHP and JavaScript with very little effort, and from what I&#8217;ve read, it might even be faster to decode (not sure about encoding, though).</p>
<p>Does anyone know of any pitfalls? Anyone have good benchmarks to show the performance benefits of either method?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dazzlecms.com/programming/php/preferred-method-to-store-php-arrays-json_encode-vs-serialize/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

