Forum und email

ucwords

(PHP 4, PHP 5)

ucwords — Gør det første tegn i hvert ord til et stort bogstav

Beskrivelse

string ucwords ( string $str )

Returnerer en streng med det første tegn af hvert ord i str som et stort bogstav, hvis dette tegn er alfabetisk.

Definitionen af et ord er enhver streng af tegn der forekommer efter et whitespace (Disse er: mellemrum, form-feed, linieskift, carriage return, horisontal tabulator and vertikal tabulator

Example#1 ucwords() eksempel

<?php
$foo 
'hello world!';
$foo ucwords($foo);             // Hello World! 

$bar 'HELLO WORLD!';
$bar ucwords($bar);             // HELLO WORLD!
$bar ucwords(strtolower($bar)); // Hello World!
?>

Note: Denne funktion er binary-safe.

Se også strtoupper(), strtolower() og ucfirst().