<?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/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: A Closer Look At ArrayObject</title>
	<atom:link href="http://www.brandonsavage.net/a-closer-look-at-arrayobject/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/</link>
	<description>The personal blog of Brandon Savage. Contains entries of a personal and professional nature focusing on PHP, Apple, LAMP, MySQL and Washington, DC.</description>
	<lastBuildDate>Fri, 03 Feb 2012 19:36:33 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Wil Moore III</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3433</link>
		<dc:creator>Wil Moore III</dc:creator>
		<pubDate>Wed, 28 Apr 2010 08:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3433</guid>
		<description>Nice post Brandon.

I recently (2 weeks ago) utilized ArrayObject in a project. Works very well for certain use cases. I hear some of the negatives presented in the comments. Right, array_* functions don&#039;t work. OK, so...use ArrayObject for what it is useful for and skip it when it fails to be useful :)</description>
		<content:encoded><![CDATA[<p>Nice post Brandon.</p>
<p>I recently (2 weeks ago) utilized ArrayObject in a project. Works very well for certain use cases. I hear some of the negatives presented in the comments. Right, array_* functions don&#8217;t work. OK, so&#8230;use ArrayObject for what it is useful for and skip it when it fails to be useful :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3420</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 27 Apr 2010 14:54:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3420</guid>
		<description>This is the first comment from you, sir. I can&#039;t delete what I never saw. Links, URLs, HTML and other items are caught by the spam filter.</description>
		<content:encoded><![CDATA[<p>This is the first comment from you, sir. I can&#8217;t delete what I never saw. Links, URLs, HTML and other items are caught by the spam filter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3418</link>
		<dc:creator>Artem</dc:creator>
		<pubDate>Tue, 27 Apr 2010 14:52:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3418</guid>
		<description>Did you delete my post? wtf?</description>
		<content:encoded><![CDATA[<p>Did you delete my post? wtf?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3412</link>
		<dc:creator>Roland</dc:creator>
		<pubDate>Tue, 27 Apr 2010 13:30:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3412</guid>
		<description>Don&#039;t know what you said in previous posts. 

Here you say:
&quot;when you execute $a = $b, the value of $b is copied, and then assigned to $a&quot;. But this is correct for scalar values only, and is wrong for objects, resources and arrays.
I said, &quot;$a = $b does not copy the object, but copies the reference to the object&quot;. The article you link to is nice, but does not cure the flimsiness of your blogpost.

Call it &quot;semantics&quot;. Talking about content, meaning and understanding. People too often tend to ignore it. I can&#039;t see, how copy-on-write and copy-on-assignment could be considered to share the same &quot;bottom line behaviour&quot;.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t know what you said in previous posts. </p>
<p>Here you say:<br />
&#8220;when you execute $a = $b, the value of $b is copied, and then assigned to $a&#8221;. But this is correct for scalar values only, and is wrong for objects, resources and arrays.<br />
I said, &#8220;$a = $b does not copy the object, but copies the reference to the object&#8221;. The article you link to is nice, but does not cure the flimsiness of your blogpost.</p>
<p>Call it &#8220;semantics&#8221;. Talking about content, meaning and understanding. People too often tend to ignore it. I can&#8217;t see, how copy-on-write and copy-on-assignment could be considered to share the same &#8220;bottom line behaviour&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3411</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 27 Apr 2010 12:05:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3411</guid>
		<description>I&#039;ve said this at least four times in previous posts. Objects are NOT passed by reference.

http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html

So what you&#039;re arguing here is that PHP handles arrays in a particular fashion, and only duplicates the data when you read/write to the array? So the bottom line behavior is the same? Sounds like we&#039;re arguing semantics.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve said this at least four times in previous posts. Objects are NOT passed by reference.</p>
<p><a href="http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html" rel="nofollow">http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html</a></p>
<p>So what you&#8217;re arguing here is that PHP handles arrays in a particular fashion, and only duplicates the data when you read/write to the array? So the bottom line behavior is the same? Sounds like we&#8217;re arguing semantics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3410</link>
		<dc:creator>Roland</dc:creator>
		<pubDate>Tue, 27 Apr 2010 12:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3410</guid>
		<description>&quot;when you execute $a = $b, the value of $b is copied, and then assigned to $a. It doesn’t matter if $b is a string, an integer, an array or an object; the value of $b is assigned to $a.&quot;

That&#039;s not correct:
If $b is an object, $a = $b does not copy the object, but copies the reference to the object.
If $b is an array, $a = $b does not copy the array, but copies the reference to the array. Then, when either $a or $b is writing to the array, the array is copied:
&lt;?php
$foo = array();
$bar = $foo;    // both variables referencing the same array

// reading the array through $bar or $foo reads the same array!


// copy on write:
$bar[] = &#039;&#039;;    
// now there are two arrays in memory,
// one for $foo; one for $bar.</description>
		<content:encoded><![CDATA[<p>&#8220;when you execute $a = $b, the value of $b is copied, and then assigned to $a. It doesn’t matter if $b is a string, an integer, an array or an object; the value of $b is assigned to $a.&#8221;</p>
<p>That&#8217;s not correct:<br />
If $b is an object, $a = $b does not copy the object, but copies the reference to the object.<br />
If $b is an array, $a = $b does not copy the array, but copies the reference to the array. Then, when either $a or $b is writing to the array, the array is copied:<br />
&lt;?php<br />
$foo = array();<br />
$bar = $foo;    // both variables referencing the same array</p>
<p>// reading the array through $bar or $foo reads the same array!</p>
<p>// copy on write:<br />
$bar[] = &#039;&#039;;<br />
// now there are two arrays in memory,<br />
// one for $foo; one for $bar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3408</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 27 Apr 2010 11:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3408</guid>
		<description>Roland, I&#039;m not entirely sure why we&#039;re arguing the semantics of &quot;copy-on-write&quot;/&quot;copy on assignment&quot;/&quot;assignment by value&quot; when really we&#039;re talking about behavior: the fact that, when you execute $a = $b, the value of $b is copied, and then assigned to $a. It doesn&#039;t matter if $b is a string, an integer, an array or an object; the value of $b is assigned to $a.

Your other points about ArrayObject are valid; you would have to typehint for ArrayObject instead of Array. There are inconsistencies in the PHP API, which are extremely frustrating but a part of how PHP works.

Andrei, I&#039;m not sure what you&#039;re looking for here. The 6th paragraph does in fact express that there is a ticket, and explains that the array_* functions don&#039;t work as you would expect. I&#039;m not about to advocate that people go vote up a ticket just because I&#039;d like to see it resolved; that&#039;s not professional in my opinion.</description>
		<content:encoded><![CDATA[<p>Roland, I&#8217;m not entirely sure why we&#8217;re arguing the semantics of &#8220;copy-on-write&#8221;/&#8221;copy on assignment&#8221;/&#8221;assignment by value&#8221; when really we&#8217;re talking about behavior: the fact that, when you execute $a = $b, the value of $b is copied, and then assigned to $a. It doesn&#8217;t matter if $b is a string, an integer, an array or an object; the value of $b is assigned to $a.</p>
<p>Your other points about ArrayObject are valid; you would have to typehint for ArrayObject instead of Array. There are inconsistencies in the PHP API, which are extremely frustrating but a part of how PHP works.</p>
<p>Andrei, I&#8217;m not sure what you&#8217;re looking for here. The 6th paragraph does in fact express that there is a ticket, and explains that the array_* functions don&#8217;t work as you would expect. I&#8217;m not about to advocate that people go vote up a ticket just because I&#8217;d like to see it resolved; that&#8217;s not professional in my opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maarten</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3403</link>
		<dc:creator>Maarten</dc:creator>
		<pubDate>Mon, 26 Apr 2010 19:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3403</guid>
		<description>Andrei: you&#039;re right but your tone is wrong.</description>
		<content:encoded><![CDATA[<p>Andrei: you&#8217;re right but your tone is wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3402</link>
		<dc:creator>Roland</dc:creator>
		<pubDate>Mon, 26 Apr 2010 17:17:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3402</guid>
		<description>You say &quot;Arrays [...] are copied on assignment&quot;. That&#039;s wrong. 
Arrays are copied on write.

Besides that ArrayObject is not supported by PHP&#039;s array-functions, it does not pass an array-typehint (nor does an array pass an ArrayObject-typehint).

IMHO ArrayObject is massively overestimated (and - as a concrete class - depending on it should be avoided).</description>
		<content:encoded><![CDATA[<p>You say &#8220;Arrays [...] are copied on assignment&#8221;. That&#8217;s wrong.<br />
Arrays are copied on write.</p>
<p>Besides that ArrayObject is not supported by PHP&#8217;s array-functions, it does not pass an array-typehint (nor does an array pass an ArrayObject-typehint).</p>
<p>IMHO ArrayObject is massively overestimated (and &#8211; as a concrete class &#8211; depending on it should be avoided).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrei</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3401</link>
		<dc:creator>Andrei</dc:creator>
		<pubDate>Mon, 26 Apr 2010 16:11:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3401</guid>
		<description>I know what the docs say, but you&#039;re not rehashing the documentation here, you&#039;re writing an article. If anything, it would be helpful if you pointed out in your post exactly what your previous comment said.</description>
		<content:encoded><![CDATA[<p>I know what the docs say, but you&#8217;re not rehashing the documentation here, you&#8217;re writing an article. If anything, it would be helpful if you pointed out in your post exactly what your previous comment said.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3400</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Mon, 26 Apr 2010 15:37:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3400</guid>
		<description>I point you to the documentation itself (http://php.net/manual/en/class.arrayobject.php) which states, &quot; this class allows objects to work as arrays.&quot;

If I had my way I&#039;d have all the array functions take ArrayObjects and treat them like arrays; I voted up the change request put in by Christian Wenske.</description>
		<content:encoded><![CDATA[<p>I point you to the documentation itself (<a href="http://php.net/manual/en/class.arrayobject.php" rel="nofollow">http://php.net/manual/en/class.arrayobject.php</a>) which states, &#8221; this class allows objects to work as arrays.&#8221;</p>
<p>If I had my way I&#8217;d have all the array functions take ArrayObjects and treat them like arrays; I voted up the change request put in by Christian Wenske.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrei</title>
		<link>http://www.brandonsavage.net/a-closer-look-at-arrayobject/#comment-3399</link>
		<dc:creator>Andrei</dc:creator>
		<pubDate>Mon, 26 Apr 2010 15:29:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1284#comment-3399</guid>
		<description>I don&#039;t see how you can say both that ArrayObject &quot;is designed to behave exactly like an array&quot; and that you cannot use it with majority of functions that accept arrays. Pick one.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t see how you can say both that ArrayObject &#8220;is designed to behave exactly like an array&#8221; and that you cannot use it with majority of functions that accept arrays. Pick one.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 4/11 queries in 0.022 seconds using disk: basic
Content Delivery Network via Amazon Web Services: S3: files.brandonsavage.net.s3.amazonaws.com

Served from: www.brandonsavage.net @ 2012-02-07 04:23:17 -->
