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
 [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

Pull Requests

Pull requests:

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: Thu Nov 21 09:01:32 2024 UTC