Heim > php教程 > php手册 > Hauptteil

分享php中几个字符函数小结

WBOY
Freigeben: 2016-06-13 10:47:03
Original
948 Leute haben es durchsucht

下面小结PHP中的几个字符函数, 小结一下:
 
1)ucfirst
   将首字母变大写,比如
  $string = "this is my web development blog";
 
echo ucfirst($string);
 
// Output: This is my web development blog
 
2) lcfirst,将首字母变小写
   $string = "This is my Web Development Blog";
 
echo lcfirst($string);
 
// Output: this is my Web Development Blog
 
3)strtoupper,将整个字符串变大写
   $string = "this is my web development blog";
 
echo strtoupper($string);
 
// Output: THIS IS MY WEB DEVELOPMENT BLOG
 
4)strtoplower,将整个字符串变小写
   $string = "tHiS is mY WeB DevElOpMenT bLoG";
 
echo strtolower($string);
 
// Output: this is my web development blog
 
5)ucwords(),可以将句子中每个单词的第一个字母变大写,比如
   $string = "this is my web development blog";
 
echo ucwords($string);
 
// Output: This Is My Web Development Blog

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!