title: php filter array values and remove duplicates from multi dimensional array
body: <p>Hello all im trying to find duplicate x values from this array and remove them and only leave the unique ones. For example my array is </p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [x] =&gt; 0.5
          [y] =&gt; 23
      )
  
  [1] =&gt; Array
      (
          [x] =&gt; 23
          [y] =&gt; 21.75
      )
  
  [2] =&gt; Array
      (
          [x] =&gt; 14.25
          [y] =&gt; 21.875
      )
  
  [3] =&gt; Array
      (
          [x] =&gt; 19.375
          [y] =&gt; 21.75
      )
  
  [4] =&gt; Array
      (
          [x] =&gt; 9.125
          [y] =&gt; 21.875
      )
  
  [5] =&gt; Array
      (
          [x] =&gt; 23
          [y] =&gt; 19.625
      )
  
  [6] =&gt; Array
      (
          [x] =&gt; 19.375
          [y] =&gt; 19.625
      ) 
  )
  </code></pre>
  
  <p>So what i need to happen is loops through the entire thing and see the first x value as .5 then continue and whatever else has x as .5 remove it from the array so that at the end i have a array that looks like this</p>
  
  <pre><code> Array
     (
  [0] =&gt; Array
      (
          [x] =&gt; 0.5
          [y] =&gt; 23
      )
  
  [1] =&gt; Array
      (
          [x] =&gt; 23
          [y] =&gt; 21.75
      )
  
  [2] =&gt; Array
      (
          [x] =&gt; 14.25
          [y] =&gt; 21.875
      )
  
  [3] =&gt; Array
      (
          [x] =&gt; 19.375
          [y] =&gt; 21.75
      )
  
  [4] =&gt; Array
      (
          [x] =&gt; 9.125
          [y] =&gt; 21.875
      )
  )
  </code></pre>
  
  <p>where all the X values are unique. I searched online and found this function to use but this doesnt seem to work:</p>
  
  <pre><code> $result = array_map("unserialize", array_unique(array_map("serialize", $array)));    
  </code></pre>