title: Matching a closest number
body: <p>I have a series of numbers from 0 to 59 which are listed to a given step value. For example if I have Step value is 5 then the series become.</p>
  
  <p>0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55</p>
  
  <p>(or if the Step was 3, it'd become 0, 3, 6, 9, 12 .... 59 etc etc)</p>
  
  <p>Now I need to find the closest match on a given user number. For example, if I the user number 18,19 or 20 then the closest match is 20. If the user number is 16,17 then it's 15.
  I am assuming this examples for step value of 5. But if it could be for any step value, then that would be great. </p>
  
  <p>How do I do that?</p>
  
  <pre><code>$step = 5; 
  $usernumber = 18;
  $myseries = range(0, 59, $step);
  foreach($myseries as $num) {
    echo $num.'&lt;br /&gt;';
  
    //if($usernumber is close to $num) { 
    //      echo 'Matching number is '.$num;
    //}
  }
  </code></pre>