- round: documentation ( source)
- in_array: documentation ( source)
- max: documentation ( source)
- range: documentation ( source)
<?php
$step = 5;
$usernumber = 18;
$myseries = range(0, 59, $step);
$myseries = range(0, 59, 5);
$check = round($usernumber/$step) * $step;
echo "<br>".$check."--";
if(in_array($check,$myseries))
echo "<br>".$check."--";
else
echo max(myseries);