title: how do I Sort and organize data from csv file in php
body: <p>I have a csv file with my vehicle inventory, I would like to know how to sort that inventory by how long I have had it. </p>
  
  <p>This is what I would like to output - </p>
  
  <p>30 cars 0-30 days old </p>
  
  <p>25 cars 31-60 days old </p>
  
  <p>10 cars 60-90 days old </p>
  
  <p>2 cars 90+ days old</p>
  
  <p>I have a variable called $numberDays which calculates the days I have had the car and gives me an integer like "30" or whatever it is..</p>
  
  <p>Here is what I have - 
  $csv is the array</p>
  
  <pre><code>foreach($csv as $car){
  
  //Calculate days in stock
  $todaydate = date("m/d/Y");
  $dis = $car[21]; //date stocked in
  $startTimeStamp = strtotime($todaydate);
  $endTimeStamp = strtotime($dis);
  $timeDiff = abs($endTimeStamp - $startTimeStamp);
  $numberDays = $timeDiff/86400; 
  $numberDays = intval($numberDays);
  
  }
  </code></pre>