php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: peebidj at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-09-07 13:32 UTC] peebidj at hotmail dot com
Description:
------------
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)

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

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

ucwords(strtolower($foo), ' ('));
 [2014-07-12 03:25 UTC] datibbaw@php.net
-Status: Open +Status: Closed -Package: *General Issues +Package: Strings related -Assigned To: +Assigned To: datibbaw
 [2014-07-12 03:25 UTC] datibbaw@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 05:01:30 2024 UTC