Return to Snippet

Revision: 5448
at March 10, 2008 07:42 by gbot


Initial Code
function  titleCase($string)  { 
        $len=strlen($string); 
        $i=0; 
        $last= ""; 
        $new= ""; 
        $string=strtoupper($string); 
        while  ($i<$len): 
                $char=substr($string,$i,1); 
                if  (ereg( "[A-Z]",$last)): 
                        $new.=strtolower($char); 
                else: 
                        $new.=strtoupper($char); 
                endif; 
                $last=$char; 
                $i++; 
        endwhile; 
        return($new); 
};

Initial URL


Initial Description


Initial Title
String to title case

Initial Tags


Initial Language
PHP