ucwords

(PHP 4, PHP 5, PHP 7)

ucwords锟斤拷锟街凤拷锟斤拷锟斤拷每锟斤拷锟斤拷锟绞碉拷锟斤拷锟斤拷母转锟斤拷为锟斤拷写

说锟斤拷

ucwords ( string $str [, string $delimiters = " \t\r\n\f\v" ] ) : string

锟斤拷 str 锟斤拷每锟斤拷锟斤拷锟绞碉拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟侥革拷锟阶拷锟轿拷锟叫达拷锟侥革拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤单锟绞的讹拷锟斤拷锟角斤拷锟斤拷锟斤拷 delimiters 锟斤拷锟斤拷锟斤拷默锟较o拷锟秸革拷锟斤拷锟斤拷票锟斤拷锟斤拷锟斤拷锟叫凤拷锟斤拷锟截筹拷锟斤拷锟斤拷水平锟斤拷锟皆硷拷锟斤拷锟竭o拷之锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟�

锟斤拷锟斤拷

str

锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷

delimiters

锟斤拷选锟斤拷 delimiters锟斤拷锟斤拷锟斤拷锟剿碉拷锟绞分革拷锟街凤拷锟斤拷

锟斤拷锟斤拷值

锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟�

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
5.4.32, 5.5.16 锟斤拷锟斤拷锟斤拷 delimiters 锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

Example #1 ucwords() 锟斤拷锟斤拷

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

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

Example #2 ucwords() 锟皆讹拷锟斤拷 delimiters 锟斤拷锟斤拷锟斤拷

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

$baz ucwords($foo"|");        // Hello|World!
?>

注锟斤拷

Note: 锟剿猴拷锟斤拷锟缴帮拷全锟斤拷锟节讹拷锟斤拷锟狡讹拷锟斤拷

锟轿硷拷

  • strtoupper() - 锟斤拷锟街凤拷锟斤拷转锟斤拷为锟斤拷写
  • strtolower() - 锟斤拷锟街凤拷锟斤拷转锟斤拷为小写
  • ucfirst() - 锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷母转锟斤拷为锟斤拷写
  • mb_convert_case() - 锟斤拷锟街凤拷锟斤拷锟斤拷锟叫达拷小写转锟斤拷