Forum Moderators: coopster
$range=split('\s*-\s*', trim($time));
$options=array();
settype($range[0], 'float');
settype($range[1], 'float'); for($i=$range[0];$i<$range[1];$i++){
$options[]=$i . ' - ' . ($i+1) ;
}
the problem is that if the time is 4.30 - 6.30 it splits this into 4.3 - 5.3 and 5.3 - 6.3. i need it to produce 4.30 - 5.30. i cant use the integer settype because it then rounds to whole numbers! Can anybody help?
thanks
for($i=$range[0];$i<$range[1];$i++){
//$options[]=$i . ' - ' . ($i+1) ;
$options[] = sprintf [php.net]('%0.2f - %0.2f', $i, $i+1);
}