funziona perfettamente:
Codice PHP:
                                    <select name="orario">
                                        <?php

                                        
function listaorari($from$to$gap) {
                                            
$listaorari = array();
                                            
$f substr($from02) * 60 substr($from32);
                                            
$t substr($to02) * 60 substr($to32);
                                            for (
$i $f$i <= $t$i+=$gap) {
                                                
$n intval($i 60);
                                                
$o str_pad($n2'0'STR_PAD_LEFT) . ':' str_pad($i $n 602'0'STR_PAD_LEFT);
                                                
$listaorari[] = $o;
                                            };
                                            return (
$listaorari);
                                        }

                                        foreach (
listaorari($ristHrApe$ristHrChiu30) as $hr => $val) {
                                            echo 
'<option>' $val '</option>';
                                        }
                                        
//var_export(listaorari($ristHrApe, $ristHrChiu, 30));
                                        
?>
                                    </select>
i valori che passo alla funzione li prendo da db.
grazie mille!!