Hướng dẫn how do you capitalize all letters in php? - làm thế nào để bạn viết hoa tất cả các chữ cái trong php?

❮ Tham chiếu chuỗi PHP

Thí dụ

Chuyển đổi tất cả các ký tự thành chữ hoa:

echo strtoupper("Hello WORLD!");
?>

Hãy tự mình thử »


Định nghĩa và cách sử dụng

Hàm strtouper () chuyển đổi một chuỗi thành chữ hoa.

Lưu ý: Hàm này an toàn cho nhị phân. This function is binary-safe.

Các chức năng liên quan:

  • Strtolower () - Chuyển đổi chuỗi thành chữ thường
  • lcfirst () - Chuyển đổi ký tự đầu tiên của chuỗi thành chữ thường
  • ucfirst () - Chuyển đổi ký tự đầu tiên của chuỗi thành chữ hoa
  • UCWords () - Chuyển đổi ký tự đầu tiên của mỗi từ trong chuỗi thành chữ hoa

Cú pháp

Giá trị tham số

Tham sốSự mô tả
sợi dâyYêu cầu. Chỉ định chuỗi để chuyển đổi

Chi tiết kỹ thuật

Giá trị trở lại:Trả về chuỗi dưới
Phiên bản PHP:4+

❮ Tham chiếu chuỗi PHP


Dave ¶

4 năm trướcMake a string uppercase

(LC_CTYPE, 'de_DE.UTF8');echo strtoupper('Umlaute äöü in uppercase'); // outputs "UMLAUTE äöü IN UPPERCASE"echo mb_strtoupper('Umlaute äöü in uppercase', 'UTF-8'); // outputs "UMLAUTE ÄÖÜ IN UPPERCASE"?> 1

Oliv. ¶(string $string): string

Làm thế nào để bạn tận dụng tất cả các chuỗi?

Phương thức TOUPPERCase () chuyển đổi một chuỗi thành chữ hoa. Phương thức ToupperCase () không thay đổi chuỗi gốc.

Làm thế nào để bạn tạo một bản in hoa trong mysql?

Hàm trên () chuyển đổi một chuỗi thành trường hợp trên. Lưu ý: Hàm này bằng với hàm uCase ().

Làm thế nào tôi có thể sử dụng trường hợp lạc đà trong PHP?

hàm DashTocamelCase ($ String, $ capitalizeFirstChe = false) {$ str = str_replace ('-', '', ucWords ($ String, '-')); if (! $ capitalizeFirstChearacter) {$ str = lcfirst ($ str); } trả về $ str; echo dashtocamelcase ('this-is-a-test chuỗi'); Hàm 'lcfirst' cần được sử dụng thay vì 'strtolower'.

Làm thế nào bạn có thể biết nếu một ký tự là chữ hoa hoặc chữ thường trong PHP?

Hàm ctype_upper () trong PHP được sử dụng để kiểm tra từng ký tự của một chuỗi đã cho có bằng chữ hoa hay không. Nếu chuỗi trong trường hợp trên thì nó sẽ trả về true nếu không sẽ trả về sai.strtoupper() example

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>

Ghi chú

Lưu ý: Hàm này an toàn cho nhị phân.: This function is binary-safe.

Xem thêm

  • strtolower () - tạo chữ thường chuỗi
  • ucfirst () - Tạo nhân vật chữ hoa đầu tiên của chuỗi
  • ucwords () - chữ hoa, ký tự đầu tiên của mỗi từ trong một chuỗi
  • mb_strtoupper () - tạo một chuỗi chữ hoa

Andre tại Koethur Dot de ¶

9 năm trước

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:

setlocale

(LC_CTYPE, 'de_DE.UTF8');

echo

strtoupper('Umlaute äöü in uppercase'); // outputs "UMLAUTE äöü IN UPPERCASE"
echo mb_strtoupper('Umlaute äöü in uppercase', 'UTF-8'); // outputs "UMLAUTE ÄÖÜ IN UPPERCASE"?>

uilmind tại fv.com.ua ¶

6 năm trước

Here is how to make the character in upper case, except HTML-entities:

$s = substr(preg_replace('/(?<=^|;)(.+?)(?=&[0-9A-Za-z]+;|$)/e', "strtoupper('$1')", ' '.$s), 1);

There is small kludge, however. Unfortunately I tired to find out the way how to exclude HTML-entity at the start of the line, so I have added 1 dummy character at the start of the text and removing it after the conversion.

string0

MEC tại Stadeleck Dot org ¶

19 năm trước

string1

James tại Snasta Dot tức là ¶

10 năm trước

string2

string3

string4

string0

Bart tại Insane Dot tại ¶

16 năm trước

string6

string7

string0

Ẩn danh ¶

17 năm trước

string9

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
0

string0

Spaceman tại Foo Dot tại ¶

14 năm trước

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
2

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
3

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
4

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
5

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
6

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
8

$str "Mary Had A Little Lamb and She LOVED It So";
$str strtoupper($str);
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
9

Ẩn danh ¶

17 năm trước

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:0

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:1

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:2

Spaceman tại Foo Dot tại ¶

14 năm trước

string0

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:4

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:5

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:6

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:7

smieat ¶

12 năm trước

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:8

One might think that setting the correct locale would do the trick with for example german umlauts, but this is not the case. You have to use mb_strtoupper() instead:9

string0

Runet ¶

17 năm trước

1

2

string0

Spaceman tại Foo Dot tại ¶

14 năm trước

4

5

6

7

8

string0

smieat ¶

9

setlocale0

setlocale1

setlocale2

setlocale3

setlocale4

string0

12 năm trước

Runet ¶

setlocale6

setlocale7

setlocale8

setlocale9

string0

15 năm trước

willyann tại gmail dot com

Chris tại bảng4 dot com ¶

13 năm trước

12 năm trước

(LC_CTYPE, 'de_DE.UTF8');

echo

strtoupper('Umlaute äöü in uppercase'); // outputs "UMLAUTE äöü IN UPPERCASE"
echo mb_strtoupper('Umlaute äöü in uppercase', 'UTF-8'); // outputs "UMLAUTE ÄÖÜ IN UPPERCASE"?>

2

(LC_CTYPE, 'de_DE.UTF8');

echo

strtoupper('Umlaute äöü in uppercase'); // outputs "UMLAUTE äöü IN UPPERCASE"
echo mb_strtoupper('Umlaute äöü in uppercase', 'UTF-8'); // outputs "UMLAUTE ÄÖÜ IN UPPERCASE"?>

3

(LC_CTYPE, 'de_DE.UTF8');

echo

strtoupper('Umlaute äöü in uppercase'); // outputs "UMLAUTE äöü IN UPPERCASE"
echo mb_strtoupper('Umlaute äöü in uppercase', 'UTF-8'); // outputs "UMLAUTE ÄÖÜ IN UPPERCASE"?>

4

(LC_CTYPE, 'de_DE.UTF8');

echo

strtoupper('Umlaute äöü in uppercase'); // outputs "UMLAUTE äöü IN UPPERCASE"
echo mb_strtoupper('Umlaute äöü in uppercase', 'UTF-8'); // outputs "UMLAUTE ÄÖÜ IN UPPERCASE"?>

5

Làm thế nào để bạn tận dụng tất cả các chuỗi?

Phương thức TOUPPERCase () chuyển đổi một chuỗi thành chữ hoa.Phương thức ToupperCase () không thay đổi chuỗi gốc. converts a string to uppercase letters. The toUpperCase() method does not change the original string.

Làm thế nào để bạn tạo một bản in hoa trong mysql?

Hàm trên () chuyển đổi một chuỗi thành trường hợp trên.Lưu ý: Hàm này bằng với hàm uCase (). converts a string to upper-case. Note: This function is equal to the UCASE() function.

Làm thế nào tôi có thể sử dụng trường hợp lạc đà trong PHP?

hàm DashTocamelCase ($ String, $ capitalizeFirstChe = false) {$ str = str_replace ('-', '', ucWords ($ String, '-'));if (! $ capitalizeFirstChearacter) {$ str = lcfirst ($ str);} trả về $ str;echo dashtocamelcase ('this-is-a-test chuỗi');Hàm 'lcfirst' cần được sử dụng thay vì 'strtolower'.

Làm thế nào bạn có thể biết nếu một ký tự là chữ hoa hoặc chữ thường trong PHP?

Hàm ctype_upper () trong PHP được sử dụng để kiểm tra từng ký tự của một chuỗi đã cho có bằng chữ hoa hay không.Nếu chuỗi trong trường hợp trên thì nó sẽ trả về true nếu không sẽ trả về sai.ctype_upper() function in PHP used to check each and every character of a given string is in uppercase or not. If the string in upper case then it returns TRUE otherwise returns False.