PHP 4.0 Bug #8326 Updated: ucfirst() has no effect if input is ALL CAPITALIZED
| From: | david@php.net | Date: | Wed, 10 Jan 2001 07:03:43 +0000 |
| Subject: | PHP 4.0 Bug #8326 Updated: ucfirst() has no effect if input is ALL CAPITALIZED | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-43640@lists.php.net to get a copy of this message | ||
ID: 8326
Updated by: david
Reported By: vitaliyf@gameaholic.com
Old-Status: Open
Status: Closed
Bug Type: Feature/Change Request
Assigned To:
Comments:
This is completely bogus and would break all existing scripts. The purpose of ucfirst is just to
uppercase the first letter and make no other changes.
If you really want that, why not simply do ucfirst(strtolower($var)). Ditto ucwords.
Previous Comments:
---------------------------------------------------------------------------
[2000-12-19 22:09:01] ronabop@php.net
Changed to a feature request.
The first letters are put into upper case, as per the function name and description.... an alternate
function such as "title case" could be interesting, but
ucfirst(strtolower($string));
will also accomplish this.
---------------------------------------------------------------------------
[2000-12-19 21:07:33] vitaliyf@gameaholic.com
A little correction:
Above bug report refers to ucwords(), however ucfirst() has exact same problem. ucfirst("HELLO
WORLD") should return "Hello world".
---------------------------------------------------------------------------
[2000-12-19 20:55:02] vitaliyf@gameaholic.com
Running ucfirst() on a string which is already all capitalized has no effect:
<?php print ucfirst("HELLO WORLD"); ?>
will print "HELLO WORLD".
The expected behavior here is probably to return "Hello World".
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8326