PX : code

titleCase by Colin Viebrock
Download this code


<?php
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);
};
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.