note 45331 added to function.strtoupper

From: Date: Thu, 02 Sep 2004 11:06:24 +0000
Subject: note 45331 added to function.strtoupper
Groups: php.notes 
Request: Send a blank email to php-notes+get-75934@lists.php.net to get a copy of this message
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; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.strtoupper.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45331 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45331&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45331&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75934) next »