<?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>YamdaBlam! &#187; #php</title>
	<atom:link href="http://www.yamdablam.com/tag/php-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yamdablam.com</link>
	<description>YATB - Yet Another Technology Blog.</description>
	<lastBuildDate>Wed, 06 Jul 2011 09:33:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cannot use object of type stdClass as array</title>
		<link>http://www.yamdablam.com/2010/07/19/cannot-use-object-of-type-stdclass-as-array/</link>
		<comments>http://www.yamdablam.com/2010/07/19/cannot-use-object-of-type-stdclass-as-array/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 11:11:49 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[#php]]></category>
		<category><![CDATA[#webdev]]></category>
		<category><![CDATA[cannot use object of type stdClass]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php error]]></category>
		<category><![CDATA[stdClass]]></category>
		<category><![CDATA[type casting]]></category>

		<guid isPermaLink="false">http://www.yamdablam.com/?p=36</guid>
		<description><![CDATA[Problem I was getting this particular error when decoding JSON data block from a web service. It basically is trying to assert that the data block is a different type to the variable which it is being assigned to. Meet solution Explore the data dump by using something like echo &#8216;&#60;pre&#62;&#8217;;  print_r($dataDump); echo &#8216;&#60;/pre&#62;&#8217;; and [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
										<iframe
											style="height:25px !important; border:none !important; overflow:hidden !important; width:340px !important;" frameborder="0" scrolling="no" allowTransparency="true"
											src="http://www.linksalpha.com/social?link=http%3A%2F%2Fwww.yamdablam.com%2F2010%2F07%2F19%2Fcannot-use-object-of-type-stdclass-as-array%2F&fc=333333&fs=arial&fblname=like">
										</iframe>
										</div><p><span style="text-decoration: underline;"><strong>Problem</strong></span></p>
<p>I was getting this particular error when decoding <a href="http://www.json.org" target="_blank">JSON</a> data block from a web service.</p>
<p>It basically is trying to assert that the data block is a different type to the variable which it is being assigned to.</p>
<p><span style="text-decoration: underline;"><strong>Meet solution</strong></span></p>
<p>Explore the data dump by using something like</p>
<blockquote><p>echo &#8216;&lt;pre&gt;&#8217;;  print_r($dataDump); echo &#8216;&lt;/pre&gt;&#8217;;</p></blockquote>
<p>and you will see the different data types for example:</p>
<blockquote><p>stdClass Object ( [acc] =&gt; Array &#8230;.</p></blockquote>
<p>Drill down through the structure to the data you want and check the data type of it. To prevent this error, simply apply some <a href="http://bit.ly/dczDKZ" target="_blank">Type casting</a> during the variable assignment. Bada-bing&#8230; problem, meet solution.</p>
<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
										<iframe
											style="height:25px !important; border:none !important; overflow:hidden !important; width:340px !important;" frameborder="0" scrolling="no" allowTransparency="true"
											src="http://www.linksalpha.com/social?link=http%3A%2F%2Fwww.yamdablam.com%2F2010%2F07%2F19%2Fcannot-use-object-of-type-stdclass-as-array%2F&fc=333333&fs=arial&fblname=like">
										</iframe>
										</div>]]></content:encoded>
			<wfw:commentRss>http://www.yamdablam.com/2010/07/19/cannot-use-object-of-type-stdclass-as-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

