|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34407 ucwords and Title Case
Submitted: 2005-09-07 13:32 UTC Modified: 2014-07-12 03:25 UTC
From: peebidj at hotmail dot com Assigned: datibbaw (profile)
Status: Closed Package: Strings related
PHP Version: 4.4.0 OS: All
Private report: No CVE-ID: None
 [2005-09-07 13:32 UTC] peebidj at hotmail dot com
Non alphanumeric characters are influencing the functionality of strtolower and ucwords. When a character in the example is right after a parenthesis, that character is not seen as the first in the word, and hence is not capitalized. This was reported and dismissed earlier, however, I feel that this is something that needs to be looked at, since common sense tells us that any non-alphanumeric character cannot be capitilized.

Reproduce code:
$foo = "Krung Thep (Bangkok)";
$bar = ucwords(strtolower($foo));

echo $foo;

Expected result:
Krung Thep (Bangkok)

Actual result:
Krung Thep (bangkok)


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-12 03:23 UTC]
-Package: Feature/Change Request +Package: *General Issues
 [2014-07-12 03:23 UTC]
With the fix in place you can now do:

ucwords(strtolower($foo), ' ('));
 [2014-07-12 03:25 UTC]
-Status: Open +Status: Closed -Package: *General Issues +Package: Strings related -Assigned To: +Assigned To: datibbaw
 [2014-07-12 03:25 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 01:01:27 2024 UTC