if (substr('$taula_motius [$counter]',0,1) != " ") { echo "</optgroup>"; echo "<optgroup label=\"".$taula_motius [$counter]. "\">"; }