ucwords
Description
Syntax
ucwords( string $string, string $separators = " \t\r\n\f\v" ): string
Parameters
string
The input string.
separators
The optional separators contains the word separator characters.
String | ASCII | Description |
---|---|---|
"\t" | ASCII 9 (0x09) | a tab |
"\n" | ASCII 10 (0x0A) | a new line (line feed) |
"\v" | ASCII 11 (0x0B) | a vertical tab |
"\f" | ASCII 12 (0x0C) | a form feed |
"\r" | ASCII 13 (0x0D) | a carriage return |
" " | ASCII 32 (0x20) | an ordinary space |
Return
Returns the modified string.
Examples
1 · string
<? $string = "case case case"; $return = ucwords($string); echo $return; ?>
Case Case Case
2 · separators · |
<? $string = "case|case|case"; $separators = "|"; $return = ucwords($string, $separators); echo $return; ?>
Case|Case|Case
3 · separators · \t\r\n\f\v
<? $string = "case\tcase\ncase\vcase\fcase\rcase case"; $separators = " \t\r\n\f\v"; $return = ucwords($string, $separators); echo $return; ?>
Case Case CaseCaseCase Case Case
4 · separators · #%&,'|
<? $string = "case#case%case&case,case'case|case"; $separators = "#%&,'|"; $return = ucwords($string, $separators); echo $return; ?>
Case#Case%Case&Case,Case'Case|Case
5 · separators · \t\r\n\f\v#%&,'|
<? $string = "case\tcase\ncase\vcase\fcase\rcase case#case%case&case,case'case|case"; $separators = " \t\r\n\f\v#%&,'|"; $return = ucwords($string, $separators); echo $return; ?>
Case Case CaseCaseCase Case Case#Case%Case&Case,Case'Case|Case
Links
Related
String
- addcslashes
- addslashes
- bin2hex
- chop
- chr
- chunk_split
- convert_uudecode
- convert_uuencode
- count_chars
- crc32
- crypt
- echo
- explode
- fprintf
- get_html_translation_table
- hebrev
- hebrevc
- hex2bin
- html_entity_decode
- htmlentities
- htmlspecialchars
- htmlspecialchars_decode
- implode
- join
- lcfirst
- levenshtein
- localeconv
- ltrim
- md5
- md5_file
- metaphone
- nl_langinfo
- nl2br
- number_format
- ord
- parse_str
- printf
- quoted_printable_decode
- quoted_printable_encode
- quotemeta
- rtrim
- setlocale
- sha1
- sha1_file
- similar_text
- soundex
- sprintf
- sscanf
- str_contains
- str_decrement
- str_ends_with
- str_getcsv
- str_increment
- str_ireplace
- str_pad
- str_repeat
- str_replace
- str_rot13
- str_shuffle
- str_split
- str_starts_with
- str_word_count
- strcasecmp
- strchr
- strcmp
- strcoll
- strcspn
- strip_tags
- stripcslashes
- stripos
- stripslashes
- stristr
- strlen
- strnatcasecmp
- strnatcmp
- strncasecmp
- strncmp
- strpbrk
- strpos
- strrchr
- strrev
- strripos
- strrpos
- strspn
- strstr
- strtok
- strtolower
- strtoupper
- strtr
- substr
- substr_compare
- substr_count
- substr_replace
- trim
- ucfirst
- vfprintf
- vprintf
- vsprintf
- wordwrap