title: unique array on base on value of specific key
body: <p>I have the following array:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
      (
          [hotelID] =&gt; 10
          [hotelcategoryID] =&gt; 12
          [hotelName] =&gt; Grand Forest Metsovo
          [hotelShortDescription] =&gt; 
          [hotelVisible] =&gt; 1
          [roomID] =&gt; 2
      )
  
      [1] =&gt; Array
      (
          [hotelID] =&gt; 10
          [hotelcategoryID] =&gt; 12
          [hotelName] =&gt; Grand Forest Metsovo
          [hotelShortDescription] =&gt; 
          [hotelVisible] =&gt; 1
          [roomID] =&gt; 3
      )
  
      [2] =&gt; Array
      (
          [hotelID] =&gt; 10
          [hotelcategoryID] =&gt; 12
          [hotelName] =&gt; Grand Forest Metsovo
          [hotelShortDescription] =&gt; 
          [hotelVisible] =&gt; 1
          [roomID] =&gt; 4
      )
  
      [3] =&gt; Array
      (
          [hotelID] =&gt; 14
          [hotelcategoryID] =&gt; 7
          [hotelName] =&gt; Hotel Metropolis
          [hotelShortDescription] =&gt; 
          [hotelVisible] =&gt; 1
          [roomID] =&gt; 23
      )
  
      [4] =&gt; Array
      (
          [hotelID] =&gt; 14
          [hotelcategoryID] =&gt; 7
          [hotelName] =&gt; Hotel Metropolis
          [hotelShortDescription] =&gt; 
          [hotelVisible] =&gt; 1
          [roomID] =&gt; 24
      )
  
  )
  </code></pre>
  
  <p>I have two different hotelID keys. I would like to extract only one element (the first one) where the hotelID is unique in whole array. I am trying with following code:</p>
  
  <pre><code>$data['uniqueHotels'] = array_map('unserialize', array_unique(array_map('serialize', $hotels)));
  </code></pre>
  
  <p>but without any luck so far.</p>
  
  <p>Anyone can give me a hint?</p>