<?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: Convert simplexml object to array in php	</title>
	<atom:link href="https://www.binarytides.com/convert-simplexml-object-to-array-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Wed, 07 Aug 2019 17:31:41 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: Juan		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-204061</link>

		<dc:creator><![CDATA[Juan]]></dc:creator>
		<pubDate>Wed, 07 Aug 2019 17:31:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-204061</guid>

					<description><![CDATA[All the code in this post has been htmlentitied()]]></description>
			<content:encoded><![CDATA[<p>All the code in this post has been htmlentitied()</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ajay Kulkarni		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-158079</link>

		<dc:creator><![CDATA[Ajay Kulkarni]]></dc:creator>
		<pubDate>Fri, 11 May 2018 12:50:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-158079</guid>

					<description><![CDATA[Works perfectly, thanks.
$t = array(); // I think you can remove this line in xml2array() method.]]></description>
			<content:encoded><![CDATA[<p>Works perfectly, thanks.<br />
$t = array(); // I think you can remove this line in xml2array() method.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Fernando Lira		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-103762</link>

		<dc:creator><![CDATA[Fernando Lira]]></dc:creator>
		<pubDate>Thu, 26 Jan 2017 12:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-103762</guid>

					<description><![CDATA[This &quot;tiny&quot; great solution save me a lot of codification hours.

Thank you, bro!]]></description>
			<content:encoded><![CDATA[<p>This &#8220;tiny&#8221; great solution save me a lot of codification hours.</p>
<p>Thank you, bro!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Hina Vaja		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-90965</link>

		<dc:creator><![CDATA[Hina Vaja]]></dc:creator>
		<pubDate>Mon, 08 Aug 2016 09:48:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-90965</guid>

					<description><![CDATA[Really helpful to me this content 
Thank you so much]]></description>
			<content:encoded><![CDATA[<p>Really helpful to me this content<br />
Thank you so much</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Marc Van Coillie		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-72930</link>

		<dc:creator><![CDATA[Marc Van Coillie]]></dc:creator>
		<pubDate>Tue, 05 Apr 2016 10:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-72930</guid>

					<description><![CDATA[Hi, I&#039;m currently using your code in a new PHP script to generate KML (Googlemap, googleearth, openstreetmap) based on ical from GoogleCalendar.
I plan to deliver it using GNU LGLP license 

I could mention your name and can put your email address, are you happy with that ?
Best regards 
Marc Van Coillie (from France)]]></description>
			<content:encoded><![CDATA[<p>Hi, I&#8217;m currently using your code in a new PHP script to generate KML (Googlemap, googleearth, openstreetmap) based on ical from GoogleCalendar.<br />
I plan to deliver it using GNU LGLP license </p>
<p>I could mention your name and can put your email address, are you happy with that ?<br />
Best regards<br />
Marc Van Coillie (from France)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: delidiwane		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-67818</link>

		<dc:creator><![CDATA[delidiwane]]></dc:creator>
		<pubDate>Mon, 16 Feb 2015 02:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-67818</guid>

					<description><![CDATA[yes but this is not for large xml files over 200k lines. You will get an empty json_decode result]]></description>
			<content:encoded><![CDATA[<p>yes but this is not for large xml files over 200k lines. You will get an empty json_decode result</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Rafael Martino		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-65674</link>

		<dc:creator><![CDATA[Rafael Martino]]></dc:creator>
		<pubDate>Sun, 25 Aug 2013 23:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-65674</guid>

					<description><![CDATA[Thank you! Very helpful.]]></description>
			<content:encoded><![CDATA[<p>Thank you! Very helpful.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jake		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-65523</link>

		<dc:creator><![CDATA[jake]]></dc:creator>
		<pubDate>Sat, 08 Jun 2013 11:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-65523</guid>

					<description><![CDATA[This just savedme after pulling at my hair for quite a whhile.
thanks so much.]]></description>
			<content:encoded><![CDATA[<p>This just savedme after pulling at my hair for quite a whhile.<br />
thanks so much.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dim		</title>
		<link>https://www.binarytides.com/convert-simplexml-object-to-array-in-php/comment-page-1/#comment-65274</link>

		<dc:creator><![CDATA[Dim]]></dc:creator>
		<pubDate>Wed, 24 Oct 2012 11:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1128#comment-65274</guid>

					<description><![CDATA[Little &quot;fast&quot; fix to fix: 

SimpleXMLElement Object
(
    [gebruiker] =&#062; Array
        (
            [0] =&#062; 94
            [1] =&#062; test@test.be
        )

to:

[gebruiker] =&#062; Array
        (
            [0] =&#062; 94
            [1] =&#062; test@test.be
        )

==&#062; (see  if($xml-&#062;$k-&#062;count() == 1){ )

function xml2array($xml) {
        $arr = array();
        
        foreach ($xml-&#062;children() as $k =&#062; $r) {  
                        
            if (count($r-&#062;children()) == 0) {
                if($xml-&#062;$k-&#062;count() == 1){
                    $arr[$r-&#062;getName()] = strval($r);
                }else{
                    $arr[$r-&#062;getName()][] = strval($r);
                }//Endif
            } else {
                
                print_r(xml2array($r));
                
                $arr[$r-&#062;getName()][] = xml2array($r);
            }//Endif
        }//Endofreach
        
        return $arr;
    }]]></description>
			<content:encoded><![CDATA[<p>Little &#8220;fast&#8221; fix to fix: </p>
<p>SimpleXMLElement Object<br />
(<br />
    [gebruiker] =&gt; Array<br />
        (<br />
            [0] =&gt; 94<br />
            [1] =&gt; <a href="mailto:test@test.be">test@test.be</a><br />
        )</p>
<p>to:</p>
<p>[gebruiker] =&gt; Array<br />
        (<br />
            [0] =&gt; 94<br />
            [1] =&gt; <a href="mailto:test@test.be">test@test.be</a><br />
        )</p>
<p>==&gt; (see  if($xml-&gt;$k-&gt;count() == 1){ )</p>
<p>function xml2array($xml) {<br />
        $arr = array();</p>
<p>        foreach ($xml-&gt;children() as $k =&gt; $r) {  </p>
<p>            if (count($r-&gt;children()) == 0) {<br />
                if($xml-&gt;$k-&gt;count() == 1){<br />
                    $arr[$r-&gt;getName()] = strval($r);<br />
                }else{<br />
                    $arr[$r-&gt;getName()][] = strval($r);<br />
                }//Endif<br />
            } else {</p>
<p>                print_r(xml2array($r));</p>
<p>                $arr[$r-&gt;getName()][] = xml2array($r);<br />
            }//Endif<br />
        }//Endofreach</p>
<p>        return $arr;<br />
    }</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
