PHP method to convert the first letter of a string to uppercase, string uppercase_PHP tutorial

WBOY
Release: 2016-07-13 10:02:44
Original
825 people have browsed it

php method to convert the first letter of a string to uppercase, string capitalization

This article describes the example of php to convert the first letter of a string to uppercase. Share it with everyone for your reference. The specific analysis is as follows:

In PHP, you can use the ucfirst function to convert the first letter in a string to uppercase, and the ucwords function can convert the first letter of each word in a string to uppercase

<&#63;php
$string = "php string functions are easy to use.";
$sentence = ucfirst($string);
$title = ucwords($string);
print("$sentence\n");
print("$title\n");
print("\n");
&#63;>
Copy after login

The output results are as follows:

Php string functions are easy to use.
Php String Functions Are Easy To Use
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969506.htmlTechArticlephp method to convert the first letter of a string into uppercase, string capitalization This article tells the example of how to realize the first letter of a string in php How to convert letters to uppercase. Share it with everyone for your reference. Specifically...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template