note 14902 deleted from function.ucwords by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: mlong at spammer=0 dot infoave dot net 

----

An evolution of the previous (a little more compact I think):

$name="ReaLLY s'CREWED Name, JR.";
$break=1;
for ($i=0; $i < strlen($name); $i++)
{
 $subed=substr($name,$i,1);
 # if its a letter or num
 if (((ord($subed) > 64) && (ord($subed) < 123)) ||
     ((ord($subed) > 48) && (ord($subed) < 58)))
 {
  if ($break) { $newname .= strtoupper($subed); }
  else        { $newname .= strtolower($subed); }
  $break=0;
 }
 else
 {
  # not a letter - a boundary
  $newname .= $subed;
  $break=1;
 }
}
echo "$newname\n";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.