note 83613 deleted from function.ucfirst by nlopess
| From: | nlopess@php.net | Date: | Mon, 07 Jul 2008 12:10:28 +0000 |
| Subject: | note 83613 deleted from function.ucfirst by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141228@lists.php.net to get a copy of this message | ||
Note Submitter: Anton Agestam
----
This function capitalizes Swedish characters _and_ the usual characters that ucfirst() capitalizes.
I use it to get a dynamic header at http://www.antonagestam.se , but I don't want swedish
characters in the URL or in the filenames. [=
<?php
function capitalize ( $text ) {
$swechars = array( "å", "ä", "ö" );
$uppercaseswechars = array( "Ã
", "Ã", "Ã" );
$text = str_replace( $swechars, $uppercaseswechars, $text { 0 } ) . substr( $text, 1 );
return ucfirst( $text );
}
?>