[PHP-DEV] PHP 4.0 Bug #8326 Updated: ucfirst() has no effect if input is ALL CAPITALIZED From: david <email protected>
Date: 01/10/01

ID: 8326
Updated by: david
Reported By: vitaliyf <email protected>
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 <email protected>
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 <email protected>
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 <email protected>
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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>