note 45331 deleted from function.strtoupper by tomsommer

From: Date: Thu, 02 Sep 2004 20:22:49 +0000
Subject: note 45331 deleted from function.strtoupper by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75955@lists.php.net to get a copy of this message
Note Submitter: john at getonweb dot com dot com ---- For all those who want to print out something in "Proper Case" as it's called, here is my quick solution to that problem. It came to me when I needed to print out names of my files while browsing a directory. <? echo ProperCase($filename); // and $filename is eg. eminem - stan.mp3 // the output would be: Eminem - Stan.Mp3 // you can modify the script so that file extension is not passed as a parameter to ProperCase(). function ProperCase($input) { $input = explode(" ", $input); $output = ""; foreach( $input AS $key => $value ) $output .= strToUpper(substr($value,0,1)) . strToLower(substr($value,1)) . " "; return $output; } ?>

« previous php.notes (#75955) next »