PHP - ucfirst
Trieda
Metóda - ucfirst
(PHP 4, PHP 5, PHP 7)
The function makes the first character of a string uppercased (if that character is alphabetic).
Beware: The function does not support multibyte characters!
Procedurálne
- function ucfirst (string $str) : string
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $str | string | The input string. |
Mávratovej hodnoty
Vracia: string
Returns the string with the first character uppercased. If that character is not alphabetical, it returns the string unchanged.
Príklady
<?php
echo ucfirst('a little dog went for a walk.') . "\n";
echo ucfirst('ťapka went for a walk') . "\n"; // multibyte character!
echo ucfirst('* this string stays unchanged, because first character is not alphabetical!') . "\n";
echo ucfirst('EVERYTHING STAYS UPPERCASE');
Súvisiace manuály
- function strtolower (string $string) : string
- function ucwords (string $str, string $delimiters = \t\r\n\f\v) : string
