<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
				<title>Comments on: Using array_unique() with multidimensional arrays</title>
		<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html</link>
		<description>Using array_unique() with multidimensional arrays Comment Feed</description>
				<language>de</language>
		<pubDate>Sun, 05 Feb 2012 09:30:31 +0000</pubDate>
		<generator>mcw[blog] 'Ruby' Alpha 3</generator>
		<item>
			<title>Comment #1 by: Peter Rother</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment278</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment278</guid>
			<author>Peter Rother</author>			
			<pubDate>Mon, 09 Feb 2009 17:45:06 +0000</pubDate>
			<content:encoded><![CDATA[ Nice example, thx. I think i can use it in future projects. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #2 by: Lorem</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment400</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment400</guid>
			<author>Lorem</author>			
			<pubDate>Tue, 24 Feb 2009 15:42:40 +0000</pubDate>
			<content:encoded><![CDATA[ Did you fill in a bug report? This is really bad behavior. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #3 by: Jeremy</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment505</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment505</guid>
			<author>Jeremy</author>			
			<pubDate>Tue, 10 Mar 2009 21:45:33 +0000</pubDate>
			<content:encoded><![CDATA[ Thank you.  Clear, concise, fast.  Works fantastic.  Well done and thanks again. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #4 by: Dominik Jungowski</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment521</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment521</guid>
			<author>Dominik Jungowski</author>			
			<pubDate>Fri, 13 Mar 2009 10:57:14 +0000</pubDate>
			<content:encoded><![CDATA[ @Lorem: I just did (although there was already a similar bug report from 2001): http://bugs.php.net/bug.php?id=47642 ]]></content:encoded>
		</item>
		<item>
			<title>Comment #5 by: Frank</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment1094</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment1094</guid>
			<author>Frank</author>			
			<pubDate>Mon, 04 May 2009 23:29:53 +0000</pubDate>
			<content:encoded><![CDATA[ I need a fix for this as I've stumbled across this bug today. Unfortunately, your code outputs the exact same result as array_unique(). ]]></content:encoded>
		</item>
		<item>
			<title>Comment #6 by: Dominik Jungowski</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment1100</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment1100</guid>
			<author>Dominik Jungowski</author>			
			<pubDate>Tue, 05 May 2009 08:34:51 +0000</pubDate>
			<content:encoded><![CDATA[ An example where it puts out the same would be nice.<br />
<br />
As for the example from the blogpost: I have just tested it once more and it worked as it should.<br />
<br />
btw. the bug report was closed ("was never intended to work with multi-dimensional arrays") but at least the documentation has been updated ]]></content:encoded>
		</item>
		<item>
			<title>Comment #7 by: Dominik Jungowski</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment1857</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment1857</guid>
			<author>Dominik Jungowski</author>			
			<pubDate>Fri, 12 Jun 2009 15:46:32 +0000</pubDate>
			<content:encoded><![CDATA[ There was indeed one bug when using associative arrays. For that reason I updated the blogpost and added the preserveKeys parameter to the function. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #8 by: zeromatrix</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment7308</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment7308</guid>
			<author>zeromatrix</author>			
			<pubDate>Sun, 15 Nov 2009 01:05:05 +0000</pubDate>
			<content:encoded><![CDATA[ Thank you very much for this knowledge. After Change the PHP version 4 to 5 my old code are not workin correct, but this works very fine !! ]]></content:encoded>
		</item>
		<item>
			<title>Comment #9 by: </title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment8664</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment8664</guid>
			<author></author>			
			<pubDate>Thu, 17 Dec 2009 07:43:24 +0000</pubDate>
			<content:encoded><![CDATA[ awesome - this rocks!  and so do you!! ]]></content:encoded>
		</item>
		<item>
			<title>Comment #10 by: Mukul</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment10886</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment10886</guid>
			<author>Mukul</author>			
			<pubDate>Fri, 12 Feb 2010 13:12:29 +0000</pubDate>
			<content:encoded><![CDATA[ Thanks for this piece of code&#8230; ]]></content:encoded>
		</item>
		<item>
			<title>Comment #11 by: John Flynn</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment11726</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment11726</guid>
			<author>John Flynn</author>			
			<pubDate>Mon, 01 Mar 2010 20:03:27 +0000</pubDate>
			<content:encoded><![CDATA[ I have borrowed this functionality and left credit in the comments.  Good idea.  Thanks! ]]></content:encoded>
		</item>
		<item>
			<title>Comment #12 by: Christian</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13870</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13870</guid>
			<author>Christian</author>			
			<pubDate>Fri, 30 Apr 2010 15:04:47 +0000</pubDate>
			<content:encoded><![CDATA[ AWESOME CODE!!!! Real cool! Thx thx thx! ]]></content:encoded>
		</item>
		<item>
			<title>Comment #13 by: Christian</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13874</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13874</guid>
			<author>Christian</author>			
			<pubDate>Fri, 30 Apr 2010 17:03:16 +0000</pubDate>
			<content:encoded><![CDATA[ Is this function working with arrays of any size? Although it worked fine with smaller ones (a few hundred entries), it didn't seem to work with an array with 5500 entries as the resulting array was still the same size (and there are lots of duplicates in there). The smaller ones I tested it with were actually parts of this big one.<br />
<br />
Not sure if it's a function limit or some other server/PHP limitation.<br />
<br />
Christian ]]></content:encoded>
		</item>
		<item>
			<title>Comment #14 by: Dominik Jungowski</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13877</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13877</guid>
			<author>Dominik Jungowski</author>			
			<pubDate>Fri, 30 Apr 2010 19:51:27 +0000</pubDate>
			<content:encoded><![CDATA[ Well, I haven't tested it with a array that large so far, but I can take a look at it and see what results I get. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #15 by: Christian</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13925</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment13925</guid>
			<author>Christian</author>			
			<pubDate>Sun, 02 May 2010 11:11:27 +0000</pubDate>
			<content:encoded><![CDATA[ FYI: My array with 5500 entries is actually one of the smaller ones. The biggest one contains 110.000 entries. Support for that size would be much appreciated! ;) ]]></content:encoded>
		</item>
		<item>
			<title>Comment #16 by: </title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment14238</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment14238</guid>
			<author></author>			
			<pubDate>Fri, 14 May 2010 10:30:12 +0000</pubDate>
			<content:encoded><![CDATA[ Thanks, it solved my problem also in minutes, great work! ]]></content:encoded>
		</item>
		<item>
			<title>Comment #17 by: Dominik Jungowski</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment14252</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment14252</guid>
			<author>Dominik Jungowski</author>			
			<pubDate>Fri, 14 May 2010 16:18:37 +0000</pubDate>
			<content:encoded><![CDATA[ @Michael: I haven't had the time yet to check out your problem, but I will do it soon! ]]></content:encoded>
		</item>
		<item>
			<title>Comment #18 by: KingIsulgard</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment15705</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment15705</guid>
			<author>KingIsulgard</author>			
			<pubDate>Wed, 14 Jul 2010 14:43:58 +0000</pubDate>
			<content:encoded><![CDATA[ This is really bad coding. I wouldn't use it. This code can be so much more efficient.<br />
<br />
I wrote this code. It has the option to preserve keys, but default is non preserving keys. It is an optional parameter.<br />
<br />
function arrayUnique($array, $preserveKeys = false) {<br />
			$newArray = array();<br />
			$newKeys = array();<br />
			<br />
			// Add items to new array and remove doubles<br />
			foreach($array as $key => $item) {<br />
				$newArray[serialize($item)] = $item;<br />
				$newKeys[] = $key;<br />
			}<br />
			<br />
			// Set keys<br />
			if($preserveKeys) {<br />
				array_combine($newKeys, $newArray);<br />
			} else {<br />
				$newArray = array_values($newArray);<br />
			}<br />
			<br />
			return $newArray;<br />
		} ]]></content:encoded>
		</item>
		<item>
			<title>Comment #19 by: Achin Sharma</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment17340</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment17340</guid>
			<author>Achin Sharma</author>			
			<pubDate>Mon, 23 Aug 2010 14:28:10 +0000</pubDate>
			<content:encoded><![CDATA[ hmm cool script but somehow it didnt work for me.. alas i am kind of stuck at this.. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #20 by: Dominik Jungowski</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment18664</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment18664</guid>
			<author>Dominik Jungowski</author>			
			<pubDate>Wed, 15 Sep 2010 08:31:17 +0000</pubDate>
			<content:encoded><![CDATA[ @Christian: I can't seem to reconstruct your problem. I have just tested the code with an array of 5004 entries and the code worked fine. Do you have any more information you can provide, like samples of some array entries? ]]></content:encoded>
		</item>
		<item>
			<title>Comment #21 by: Christo</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment20123</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment20123</guid>
			<author>Christo</author>			
			<pubDate>Wed, 29 Sep 2010 22:52:00 +0000</pubDate>
			<content:encoded><![CDATA[ Very effective! Fixed my SQL join issue straight away, and its a logical solution I can understand.<br />
Thank you <br />
>_< ]]></content:encoded>
		</item>
		<item>
			<title>Comment #22 by: Yuriy</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment21946</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment21946</guid>
			<author>Yuriy</author>			
			<pubDate>Tue, 26 Oct 2010 12:37:09 +0000</pubDate>
			<content:encoded><![CDATA[ Great and WORKING example. Thank you. ]]></content:encoded>
		</item>
		<item>
			<title>Comment #23 by: Bernie</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment28139</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment28139</guid>
			<author>Bernie</author>			
			<pubDate>Wed, 26 Jan 2011 07:52:48 +0000</pubDate>
			<content:encoded><![CDATA[ While I think, this is quite a piece of sexy code, it did not work for me.<br />
<br />
I need to deal with a two-dimensional array of integers (array(x,2)), where some of the tuples are identical (and hence need to be removed).<br />
<br />
While trying to debug the problem, I found that "serialize()" did not return the same string for identical tuples - the md5-idea is therfore doomed to fail.<br />
<br />
I wonder about the "serialize()"-effect, though. It suggests, that the tuples concerned are actually not identical. But from the unserialized object this is not observable&#8230; ]]></content:encoded>
		</item>
		<item>
			<title>Comment #24 by: yi</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment43657</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment43657</guid>
			<author>yi</author>			
			<pubDate>Mon, 05 Sep 2011 10:30:32 +0000</pubDate>
			<content:encoded><![CDATA[ you can actually use array_unique() function with flag SORT_REGULAR to archive the same result ]]></content:encoded>
		</item>
		<item>
			<title>Comment #25 by: carlos</title>
			<link>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment69986</link>
			<guid>http://www.phpdevblog.net/2009/01/using-array-unique-with-multidimensional-arrays.html#comment69986</guid>
			<author>carlos</author>			
			<pubDate>Wed, 18 Jan 2012 23:27:58 +0000</pubDate>
			<content:encoded><![CDATA[ Ching Chong is right. Just use SORT_REGULAR. You are all idiots. ]]></content:encoded>
		</item>
		</channel>
</rss>
