NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:

PHP - ucfirst

Trieda

Koreň \ Bez triedy

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ázovDátový typPredvolená hodnotaPopis
$strstring

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
      Aktivity