Note that there are some explanatory texts on larger screens.

plurals
  1. POMultidimensional array unique based on value (not array key)
    primarykey
    data
    text
    <p>I have a multidimensional array which I need to be sorted with uniqueness as I have duplicated records, so I need <code>array_unique</code> to go through the array and remove duplicates by the value, e.g.</p> <pre><code>Array ( [0] =&gt; Array ( [id] =&gt; 324 [time_start] =&gt; 1301612580 [level] =&gt; 0.002 [input_level] =&gt; 0.002 ) [1] =&gt; Array ( [id] =&gt; 325 [time_start] =&gt; 1301612580 [level] =&gt; 0.002 [input_level] =&gt; 0.002 ) [2] =&gt; Array ( [id] =&gt; 326 [time_start] =&gt; 1301612580 [level] =&gt; 0.002 [input_level] =&gt; 0.002 ) ) </code></pre> <p>There are duplicated <code>time_start</code>, which they are all the same, also <code>level</code> and <code>input_level</code> but they are not to be affected, only if there are matching <code>time_start</code> it should remove it and process the whole array <em>(the array is bigger than you think, but I just posted a small example of the array)</em>. Should remove dupes and return like this:</p> <pre><code>Array ( [0] =&gt; Array ( [id] =&gt; 324 [time_start] =&gt; 1301612580 [level] =&gt; 0.002 [input_level] =&gt; 0.002 ) ) </code></pre> <p>Questions I've found that didn't work:</p> <ul> <li><a href="https://stackoverflow.com/questions/5405547/reformat-multidimensional-array-based-on-value">reformat multidimensional array based on value</a></li> <li><a href="https://stackoverflow.com/questions/4466159/delete-element-from-multidimensional-array-based-on-value">Delete element from multidimensional-array based on value</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload