Hướng dẫn how can i uppercase string in php? - làm thế nào tôi có thể viết hoa chuỗi trong php?

(Php 4, Php 5, Php 7, Php 8)

strtouper - tạo một chuỗi chữ hoaMake a string uppercase

Sự mô tả

Strtouper (Chuỗi $string): Chuỗi(string $string): string

Các byte trong phạm vi "a" (0x61) thành "z" (0x7a) sẽ được chuyển đổi thành chữ cái viết hoa tương ứng bằng cách trừ 32 từ mỗi giá trị byte.

Điều này có thể được sử dụng để chuyển đổi các ký tự ASCII trong các chuỗi được mã hóa bằng UTF-8, vì các ký tự UTF-8 Multibyte sẽ bị bỏ qua. Để chuyển đổi các ký tự không phải là ASCII, hãy sử dụng mb_strtoupper ().mb_strtoupper().

Thông số

string

Chuỗi đầu vào.

Trả về giá trị

Trả về chuỗi bán dẫn.

Thay đổi

Phiên bảnSự mô tả
8.2.0 Strtouper (Chuỗi $string): Chuỗisetlocale(). Only ASCII characters will be converted.

Các byte trong phạm vi "a" (0x61) thành "z" (0x7a) sẽ được chuyển đổi thành chữ cái viết hoa tương ứng bằng cách trừ 32 từ mỗi giá trị byte.

Điều này có thể được sử dụng để chuyển đổi các ký tự ASCII trong các chuỗi được mã hóa bằng UTF-8, vì các ký tự UTF-8 Multibyte sẽ bị bỏ qua. Để chuyển đổi các ký tự không phải là ASCII, hãy sử dụng mb_strtoupper ().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
?>

Thông số

string: This function is binary-safe.

Chuỗi đầu vào.

  • Trả về giá trị
  • Trả về chuỗi bán dẫn.
  • Thay đổi
  • Phiên bản

Chuyển đổi trường hợp không còn phụ thuộc vào tập hợp địa phương với setlocale (). Chỉ các ký tự ASCII sẽ được chuyển đổi.

Ví dụ

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"?>

Ví dụ #1 Strtouper () Ví dụ

Ghi chú

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

"a"0

"a"1

"a"2

Lưu ý: Hàm này an toàn cho nhị phân.

Xem thêm

"a"3

strtolower () - tạo chữ thường chuỗi

ucfirst () - Tạo nhân vật chữ hoa đầu tiên của chuỗi

"a"4

"a"5

"a"2

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

"a"7

"a"8

Andre tại Koethur Dot de ¶

9 năm trước

uilmind tại fv.com.ua ¶

"z"0

"z"1

"z"2

"z"3

"z"4

"z"6

"z"7

6 năm trước

MEC tại Stadeleck Dot org ¶

"z"8

"z"9

string0

"a"2

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

string2

string3

string4

Andre tại Koethur Dot de ¶

9 năm trước

uilmind tại fv.com.ua ¶

string6

string7

string8

string9

6 năm trước

MEC tại Stadeleck Dot org ¶

$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

$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
?>
1

"a"2

19 năm trước

mb_strtoupper () - tạo một chuỗi chữ hoa

$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

"a"2

Andre tại Koethur Dot de ¶

9 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
?>
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
?>
7

$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

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

uilmind tại fv.com.ua ¶

6 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: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

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:3

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

"a"2

MEC tại Stadeleck Dot org ¶

19 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

0

1

"a"2

Bart tại Insane Dot tại ¶

16 năm trước

Ẩn danh ¶

18 năm trước

MEC tại Stadeleck Dot org ¶

4

5

6

7

Có phải trường hợp trên trong PHP khô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. Các hàm liên quan: Strtolower () - Chuyển đổi một chuỗi thành chữ thường.. Note: This function is binary-safe. Related functions: strtolower() - converts a string to lowercase.

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 tạo một bản in hoa trong mysql?

Hàm mysql trên () hàm trên () Hàm 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 ().The UPPER() function converts a string to upper-case. Note: This function is equal to the UCASE() function.

Làm thế nào tôi có thể viết thường tất cả các chữ cái trong PHP?

Hàm strtolower () được sử dụng để chuyển đổi một chuỗi thành chữ thường.Hàm này lấy một chuỗi làm tham số và chuyển đổi tất cả các bảng chữ cái tiếng Anh từ trên có trong chuỗi thành chữ thường.Tất cả các ký tự số hoặc ký tự đặc biệt khác trong chuỗi vẫn không thay đổi.strtolower() function is used to convert a string into lowercase. This function takes a string as parameter and converts all the uppercase english alphabets present in the string to lowercase. All other numeric characters or special characters in the string remains unchanged.