php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1375 ucwords() doesn't like uppercase
Submitted: 1999-05-03 16:54 UTC Modified: 1999-05-04 13:34 UTC
From: graeme at kc dot co dot nz Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.6 OS: Linux i386 + Win32
Private report: No CVE-ID: None
 [1999-05-03 16:54 UTC] graeme at kc dot co dot nz
ucwords() will not process capitilised strings e.g.
$string = "HELLO THIS IS A TEST";
echo ucwords($string);

does not work but converting the string to lowercase does work.
$string = "HELLO THIS IS A TEST";
echo ucwords(strtolower($string));


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-04 13:34 UTC] sas at cvs dot php dot net
The behaviour is correct in regard to documented way ucwords should work. The documentation states:

"Capitalizes the first character of each word in str if that character is alphabetic."

It does not say anything about the rest of the word. ucwords does not touch anything but the first letter after a space character.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 13:00:01 2026 UTC