title: how to sort multi dimensional array in PHP using array value?
body: <p>I'm working in PHP CodeIgniter framework. Here I have an array with values distance field is in all the array. So I want to sort this array based on distance variable. when the distance is small it should be show at the top of the array.</p>
  
  <pre><code>Array
  (   
  
      [3] =&gt; Array
          (
  
              [distance] =&gt; 0.1867701321678877
              [search_name] =&gt; gshshs
              [type] =&gt; vendor
          )
  
      [4] =&gt; Array
          (
  
              [distance] =&gt; 0.2581692930636528
              [search_name] =&gt; imarahtech
              [type] =&gt; vendor
          )
  
      [5] =&gt; Array
          (
  
              [distance] =&gt; 13.022316349008124
              [delivery_available] =&gt; Yes
              [search_name] =&gt; mius
              [type] =&gt; vendor
          )
  
      [6] =&gt; Array
          (
  
              [distance] =&gt; 23.49767368340837
              [search_name] =&gt; imarahtech
              [type] =&gt; vendor
          )
  
      [7] =&gt; Array
          (
  
              [distance] =&gt; 37.85888922426821
              [search_name] =&gt; blu
              [type] =&gt; vendor
          )
  
  
      [8] =&gt; Array
          (
  
              [distance] =&gt; 0.18766008198496642
              [search_name] =&gt; fried rice 
              [type] =&gt; product
          )
  
      [14] =&gt; Array
          (
  
              [distance] =&gt; 13.022316349008124
              [search_name] =&gt; meals rice
              [type] =&gt; product
          )
  
      [15] =&gt; Array
          (
  
              [distance] =&gt; 37.85888922426821
              [search_name] =&gt; ayla
              [type] =&gt; product
          )
  
  )
  </code></pre>
  
  <p>so here what I wanted, Show the data Ascending order.</p>
  
  <p><strong>Output</strong></p>
  
  <pre><code>Array
  (   
  
      [3] =&gt; Array
          (
  
              [distance] =&gt; 0.1867701321678877
              [search_name] =&gt; gshshs
              [type] =&gt; vendor
          )
  
      [8] =&gt; Array
          (
  
              [distance] =&gt; 0.18766008198496642
              [search_name] =&gt; fried rice 
              [type] =&gt; product
          )
  
      [4] =&gt; Array
          (
  
              [distance] =&gt; 0.2581692930636528
              [search_name] =&gt; imarahtech
              [type] =&gt; vendor
          )
  
      [5] =&gt; Array
          (
  
              [distance] =&gt; 13.022316349008124
              [delivery_available] =&gt; Yes
              [search_name] =&gt; mius
              [type] =&gt; vendor
          )
  
      [14] =&gt; Array
          (
  
              [distance] =&gt; 13.022316349008124
              [search_name] =&gt; meals rice
              [type] =&gt; product
          )
  
      [6] =&gt; Array
          (
  
              [distance] =&gt; 23.49767368340837
              [search_name] =&gt; imarahtech
              [type] =&gt; vendor
          )
  
      [7] =&gt; Array
          (
  
              [distance] =&gt; 37.85888922426821
              [search_name] =&gt; blu
              [type] =&gt; vendor
          )
  
      [15] =&gt; Array
          (
  
              [distance] =&gt; 37.85888922426821
              [search_name] =&gt; ayla
              [type] =&gt; product
          )
  
  
  
  )
  </code></pre>
  
  <p>Somebody Please help me to overcome this problem.</p>
  
  <p>Thanking You</p>