Visa ett inlägg
Oläst 2011-03-19, 22:31 #3
KarlRoos KarlRoos är inte uppkopplad
Har WN som tidsfördriv
 
Reg.datum: Jul 2007
Inlägg: 1 416
KarlRoos KarlRoos är inte uppkopplad
Har WN som tidsfördriv
 
Reg.datum: Jul 2007
Inlägg: 1 416
PHP-kod:
$current_letter '';

foreach(
$names as $name){
    
$first_letter substr($name01);
    
    if(
$first_letter !== $current_letter){
        if(!empty(
$current_letter)){
            echo 
'</ul>';
        }
        
        echo 
'<h2>' $first_letter '</h2><ul>';
        
$current_letter $first_letter;
    }
    
    echo 
'<li>' $name '</li>';
}

echo 
'</ul>'
Lycka till!
KarlRoos är inte uppkopplad   Svara med citatSvara med citat