I searched for solutions on here but didn't find one for my use case. I have a big array which is built like this example: Array (     [0] =&gt; Array         (             [Template] =&gt; page.html5         )      [1] =&gt; Array         (             [Template] =&gt; page2.html5         )      [2] =&gt; Array         (             [Template] =&gt; page.html5         )      [3] =&gt; Array         (             [Template] =&gt; page2.html5         )      [4] =&gt; Array         (             [Template] =&gt; page.html5         )      [5] =&gt; Array         (             [Template] =&gt; page2.html5         )      [6] =&gt; Array         (             [id] =&gt; 27             [table] =&gt; tl_custom             [type] =&gt; text             [data] =&gt; Array                 (                     [fragment] =&gt; example                     [previewId] =&gt; 1                     [isActive] =&gt; 1                 )          )  )  I would like to remove all duplicate values for the array key &quot;Template&quot;, but besides that I want the array to stay the way it is. So afterwards my Array should look like: Array (     [0] =&gt; Array         (             [Template] =&gt; page.html5         )      [1] =&gt; Array         (             [Template] =&gt; page2.html5         )     [6] =&gt; Array         (             [id] =&gt; 27             [table] =&gt; tl_custom             [type] =&gt; text             [data] =&gt; Array                 (                     [fragment] =&gt; example                     [previewId] =&gt; 1                     [isActive] =&gt; 1                 )          )  )  Is there a way to achieve this without using lots of memory? Thanks for your answers :)
How can I remove duplicate values from a multi-dimensional array in PHP?  Example array:  Array (     [0] =&gt; Array     (         [0] =&gt; abc         [1] =&gt; def     )      [1] =&gt; Array     (         [0] =&gt; ghi         [1] =&gt; jkl     )      [2] =&gt; Array     (         [0] =&gt; mno         [1] =&gt; pql     )      [3] =&gt; Array     (         [0] =&gt; abc         [1] =&gt; def     )      [4] =&gt; Array     (         [0] =&gt; ghi         [1] =&gt; jkl     )      [5] =&gt; Array     (         [0] =&gt; mno         [1] =&gt; pql     )  )
Edit source differs from question view? Or are we each other's friends now? I understand the purpose of up/downvoting answers -- some answers are better than others, some answers may be wrong, .etc.  With regard to questions, though, there are other mechanisms to deal with "bad" questions:  comments, close, flag.  A poorly written question should be improved.  A bad question should be closed/deleted.  Often, though I see poorly written questions downvoted. I'm not sure what this accomplishes.  I get loss of rep for offensive or spam questions, but for an off-topic question?  or one that is just poorly written?   Why?  It seems to me that rep ought to be based more on answers on a site of this type.   Fundamentally, it seems that rep ought to be based on what you add to the site, not what you ask of it.  A particularly good question does add to the site, but a poor question doesn't really detract from it in the same way that a bad (wrong) answer does. Sure, go ahead and give people more rep for asking a particularly good question, but why punish people for asking bad questions when there are other ways of handling that.  Why not handle questions more like comments and allow upvotes, but not downvotes?  It seems to me that many, if not most, of the downvoted questions are first timers.  It's more likely that your first introduction to the site will be in asking a question, rather than answering. There is a significant risk to alienating new users when their questions are downvoted -- there's a visceral response to seeing that negative number next to your question.  Why not let the close/flag system weed out questions that don't belong and the comment system work to improve poorly worded questions. By the "No Hair Theorem", three quantities "define" a black hole; Mass, Angular Momentum, and Charge. The first is easy enough to determine, look at the radius of the event horizon and you can use the Schwarzschild formula to compute the mass. Angular Momentum can be found using the cool little ergosphere Penrose "discovered". However, I don't know how to determine the charge of the black hole.   How can an electromagnetic field escape the event horizon of a Reissner-Nordström black hole? Is there any experiment we could theoretically do to a black hole to determine its charge? What's the name of this flat illustration style? I want to buy some stock photos like the ones below. What is this design called?  I don't even know how to start searching... How to quickly and safely defrost chicken? What is the safest, quick way to defrost chicken? Microwave? Running water over it? Prove that $n$ is a sum of two squares? Problem   Let $n = p_1.p_2.p_3 \cdots p_k.m^2$, where $p_1, p_2, p_3 \cdots p_k$ are distinct primes. Prove that n is sum of two squares if and only if $p_i$ is either 2 or $p_i \equiv 1 \pmod{4}$   For $p_i = 2$ , this is trivial case since $2m^2 = m^2 + m^2$. For $p_i \equiv 1 \pmod{4}$, I tried to use the fact that the product of a number of the form $4k + 1$ is also in this form. So I come up with: $$n = (4k + 1) \cdot m^2 = 4km^2 + m^2$$ Apparently, $m^2$ is a square, but I could not figure out how to prove $4km^2$ is a square, since k is in unknown form. Any idea?    Thanks, Finding $\lim_{n\to\infty} a_n^n$ where $a_n=\frac{(n!)^2}{(n+k)!(n-k)!}$ Sophomore's dream: $\int_0^{1} x^{-x} \; dx = \sum_{n=1}^\infty n^{-n}$ Has user testing found that the "three horizontal bars" for main menu on mobile is commonly understood? Given fields $K\subseteq L$, why does $f,g$ relatively prime in $K[x]$ imply relatively prime in $L[x]$? $K,L$ are fields, $K\subseteq L$. $f,g \in K[x]$. Suppose that $f,g$ are relatively prime as elements of $K[x]$. Prove they remain relatively prime  in $L[x]$.  I've tried everything I can think of. I feel like working with the contrapositive may be helpful but that's just a feeling. How is being able to break into any Linux machine through grub2 secure? How do I prevent widow/orphan lines? how to make a 360 video (turntable) of an Object using a python script How do I automate a key press in AppleScript? Let $f:G\to K$ be a surjective group homomorphism and $H$ be a subgroup of $G$ satisfying $N_G(H)=H$. Then $N_K(f(H))=f(H)$. I'm trying to prove or disprove it. perhaps, this proposition is true. But, how can we prove it? Edit: I thought it is true because WIKI said it is true without proof Is there a method to split thousands of polylines by employing a tool like the "Editor" - "Split" method and using distance, in ArcGIS?      When I utilize the "split" - "distance" tool (fig1), it only splits one section leaving the remainder unsplit (fig2).    I have attempted the "COGO" tool - using "Proportion", and can utilize the "duplicate" button to assign the remainder of segments which seems like a viable option.  But I would like to find some way to automate this process.  Has anyone found a method to do this?  Or is Python (coding) the only way?  I am trying to split over 2000 lines into equal distance segments (fig 3) of ~600m. Each segment will have its angle measured, and will ultimately result in a rose diagram representing angular statistics.  The distance of each segment is important in my splitting regime (a long line will have a greater representation of a particular angle on my rose diagram than the neighboring shorter line segments).  I currently am using ArcGIS 10.2 with an advanced user license. I've only been able to resolve this far  $$ d \mid n \Rightarrow \exists l \in \mathbb{Z}\; \textrm{such that} \; n=dl \Rightarrow x^{q^n} - x = x^{q^{dl}} - x.$$  I can't move forward. How can I escape white space in a bash loop list? I have a bash shell script that loops through all child directories (but not files) of a certain directory.  The problem is that some of the directory names contain spaces.    Here are the contents of my test directory:  $ls -F test Baltimore/  Cherry Hill/  Edison/  New York City/  Philadelphia/  cities.txt   And the code that loops through the directories:  for f in `find test/* -type d`; do   echo $f done   Here's the output:   test/Baltimore test/Cherry Hill test/Edison  test/New York City test/Philadelphia   Cherry Hill and New York City are treated as 2 or 3 separate entries.  I tried quoting the filenames, like so:  for f in `find test/* -type d | sed -e 's/^/\"/' | sed -e 's/$/\"/'`; do   echo $f done   but to no avail.  There's got to be a simple way to do this.    The answers below are great.  But to make this more complicated - I don't always want to use the directories listed in my test directory.  Sometimes I want to pass in the directory names as command-line parameters instead.  I took Charles' suggestion of setting the IFS and came up with the following:  dirlist="${@}" (   [[ -z "$dirlist" ]] &amp;&amp; dirlist=`find test -mindepth 1 -type d` &amp;&amp; IFS=$'\n'   for d in $dirlist; do     echo $d   done )   and this works just fine unless there are spaces in the command line arguments (even if those arguments are quoted).  For example, calling the script like this: test.sh "Cherry Hill" "New York City" produces the following output:   Cherry Hill New York City How to check if running on UI thread in Android? Is explicitly closing files important?