mb_strtoupper

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

mb_strtoupper使字符串大写

说明

mb_strtoupper ( string $str [, string $encoding = mb_internal_encoding() ] ) : string

将所有的字母字符转化成大写并返回 str

参数

str

要大写的 string

encoding

encoding 参数为字符编码。如果省略,则使用内部字符编码。

返回值

str 里所有的字母都转换成大写的。

Unicode

更多 Unicode 属性的信息,请参见 » http://www.unicode.org/unicode/reports/tr21/

strtoupper() 不同的是,“字母”是通过 Unicode 字符属性来确定的。 因此这个函数不会受语言环境(locale)设置影响,能够转化任何具有“字母”属性的字符,例如 a 变音符号(ä)。

范例

Example #1 mb_strtoupper() 例子

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

Example #2 非拉丁 UTF-8 文本的 mb_strtoupper() 例子

<?php
$str 
"Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός";
$str mb_strtoupper($str'UTF-8');
echo 
$str// 打印了 ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ
?>

参见

相关文章
php 多字节字符串 函数 get a specific characterphp 多字节字符串 函数 对字符串进行大小写转换php 多字节字符串 函数 转换字符的编码php 多字节字符串 函数 convert kana one from another zen kaku han kaku and more php 多字节字符串 函数 转换一个或多个变量的字符编码php 多字节字符串 函数 retrieve the result from the last multibyte regular expression matchphp 多字节字符串 函数 setup string and regular expression for a multibyte regular expression matchphp 多字节字符串 函数 returns position and length of a matched part of the multibyte regular expression for a predefined multibyte stringphp 多字节字符串 函数 returns the matched part of a multibyte regular expressionphp 多字节字符串 函数 set start point of next regular expression matchphp 多字节字符串 函数 在输出缓冲中转换字符编码的回调函数php 多字节字符串 函数 解析 get/post/cookie 数据并设置全局变量php 多字节字符串 函数 获取 mime 字符串php 多字节字符串 函数 set/get character encoding for multibyte regexphp 多字节字符串 函数 大小写不敏感地在字符串中查找一个字符串最后出现的位置php 多字节字符串 函数 查找字符串在一个字符串中最后出现的位置php 多字节字符串 函数 查找字符串在另一个字符串里的首次出现php 多字节字符串 函数 使字符串小写php 多字节字符串 函数 使字符串大写php 字符串 函数 转换字符串第一个字节为 0 255 之间的值
关注编程学问公众号