<?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: PHP : Array to Object</title>
	<atom:link href="http://www.lost-in-code.com/programming/php-code/php-array-to-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/</link>
	<description>Web Development Resources</description>
	<lastBuildDate>Sun, 15 Aug 2010 18:16:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: shaffy</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-6923</link>
		<dc:creator>shaffy</dc:creator>
		<pubDate>Mon, 02 Aug 2010 07:56:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-6923</guid>
		<description>good programming</description>
		<content:encoded><![CDATA[<p>good programming</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaffy</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-6911</link>
		<dc:creator>shaffy</dc:creator>
		<pubDate>Sat, 31 Jul 2010 11:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-6911</guid>
		<description>Good Programming..</description>
		<content:encoded><![CDATA[<p>Good Programming..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: web development</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-1124</link>
		<dc:creator>web development</dc:creator>
		<pubDate>Thu, 10 Jun 2010 01:50:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-1124</guid>
		<description>in terms of performance which is better, object or array?</description>
		<content:encoded><![CDATA[<p>in terms of performance which is better, object or array?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Массив в объект на php</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-837</link>
		<dc:creator>Массив в объект на php</dc:creator>
		<pubDate>Wed, 03 Mar 2010 08:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-837</guid>
		<description>[...] Оригинал: на lost-in-code.com [...]</description>
		<content:encoded><![CDATA[<p>[...] Оригинал: на lost-in-code.com [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodeBoxer</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-824</link>
		<dc:creator>CodeBoxer</dc:creator>
		<pubDate>Tue, 23 Feb 2010 15:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-824</guid>
		<description>How do you deal with numeric arrays?</description>
		<content:encoded><![CDATA[<p>How do you deal with numeric arrays?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carabain</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-819</link>
		<dc:creator>carabain</dc:creator>
		<pubDate>Fri, 19 Feb 2010 15:10:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-819</guid>
		<description>Nice snippet Antonie. 
Here&#039;s a recursive version i created:

function toObject($array) {
  $obj = new stdClass();
  foreach ($array as $key =&gt; $val) {
    $obj-&gt;$key = is_array($val) ? toObject($val) : $val;
  }
  return $obj;
}</description>
		<content:encoded><![CDATA[<p>Nice snippet Antonie.<br />
Here&#8217;s a recursive version i created:</p>
<p>function toObject($array) {<br />
  $obj = new stdClass();<br />
  foreach ($array as $key =&gt; $val) {<br />
    $obj-&gt;$key = is_array($val) ? toObject($val) : $val;<br />
  }<br />
  return $obj;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ecommerce website</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-796</link>
		<dc:creator>ecommerce website</dc:creator>
		<pubDate>Fri, 05 Feb 2010 19:25:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-796</guid>
		<description>I&#039;m using the following:

foreach ($all as $value) 
{
   echo $value.&#039;&#039;;
}</description>
		<content:encoded><![CDATA[<p>I&#8217;m using the following:</p>
<p>foreach ($all as $value)<br />
{<br />
   echo $value.&#8221;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lennard Schutter</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-786</link>
		<dc:creator>Lennard Schutter</dc:creator>
		<pubDate>Wed, 20 Jan 2010 23:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-786</guid>
		<description>Multidimensional worked for me though:

$obj = (object)array(&quot;mood&quot; =&gt; (object)array(&quot;happy&quot; =&gt; &quot;lol&quot;, &quot;angry&quot; =&gt; &quot;grr&quot;),&quot;color&quot; =&gt; (object)array(&quot;blue&quot; =&gt; &quot;cold&quot;, &quot;red&quot; =&gt; &quot;hot&quot;));
	
print $obj-&gt;mood-&gt;angry;

Thanks for this post btw! Was really helpfull!</description>
		<content:encoded><![CDATA[<p>Multidimensional worked for me though:</p>
<p>$obj = (object)array(&#8220;mood&#8221; =&gt; (object)array(&#8220;happy&#8221; =&gt; &#8220;lol&#8221;, &#8220;angry&#8221; =&gt; &#8220;grr&#8221;),&#8221;color&#8221; =&gt; (object)array(&#8220;blue&#8221; =&gt; &#8220;cold&#8221;, &#8220;red&#8221; =&gt; &#8220;hot&#8221;));</p>
<p>print $obj-&gt;mood-&gt;angry;</p>
<p>Thanks for this post btw! Was really helpfull!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Williams</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-730</link>
		<dc:creator>Jay Williams</dc:creator>
		<pubDate>Wed, 16 Dec 2009 05:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-730</guid>
		<description>I&#039;ve built my own array to object function, which uses references for optimal speed and memory usage. And it also supports multi-dimensional arrays.

You can see the code here: http://gist.github.com/257606

I&#039;m thinking it would be even faster than the code you have posted.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve built my own array to object function, which uses references for optimal speed and memory usage. And it also supports multi-dimensional arrays.</p>
<p>You can see the code here: <a href="http://gist.github.com/257606" rel="nofollow">http://gist.github.com/257606</a></p>
<p>I&#8217;m thinking it would be even faster than the code you have posted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ThomasR</title>
		<link>http://www.lost-in-code.com/programming/php-code/php-array-to-object/comment-page-1/#comment-717</link>
		<dc:creator>ThomasR</dc:creator>
		<pubDate>Thu, 03 Dec 2009 14:18:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.lost-in-code.com/?p=39#comment-717</guid>
		<description>For multidimensionnal arrays : 

function object_to_array($mixed) {
    if(is_object($mixed)) $mixed = (array) $mixed;
    if(is_array($mixed)) {
        $new = array();
        foreach($mixed as $key =&gt; $val) {
            $key = preg_replace(&quot;/^\(.*)\/&quot;,&quot;&quot;,$key);
            $new[$key] = object_to_array($val);
        }
    } 
    else $new = $mixed;
    return $new;        
}</description>
		<content:encoded><![CDATA[<p>For multidimensionnal arrays : </p>
<p>function object_to_array($mixed) {<br />
    if(is_object($mixed)) $mixed = (array) $mixed;<br />
    if(is_array($mixed)) {<br />
        $new = array();<br />
        foreach($mixed as $key =&gt; $val) {<br />
            $key = preg_replace(&#8220;/^\(.*)\/&#8221;,&#8221;",$key);<br />
            $new[$key] = object_to_array($val);<br />
        }<br />
    }<br />
    else $new = $mixed;<br />
    return $new;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->