Heim >Backend-Entwicklung >PHP-Tutorial >PHP strtoupper函数有什么用

PHP strtoupper函数有什么用

PHPz
PHPzOriginal
2016-06-13 11:41:033069Durchsuche

PHP strtoupper是PHP中的一个内置函数,作用是将字符串中的所有字符转换为大写,该函数的语法是“strtoupper(string)”,返回值是转换为大写的字符串。

PHP strtoupper函数有什么用

PHP strtoupper函数有什么用?

strtoupper() 函数把字符串转换为大写。

注释:该函数是二进制安全的。

语法

strtoupper(string)

参数:

  • string:必需。规定要转换的字符串。

返回值: 返回转换为大写的字符串。

示例:

<?php
$i = "hello world";
$j = strtoupper($i);
echo $j;
?>

输出:

HELLO WORLD

扩展:相关函数

  • strtolower() - 把字符串转换为小写

  • lcfirst() - 把字符串中的首字符转换为小写

  • ucfirst() - 把字符串中的首字符转换为大写

  • ucwords() - 把字符串中每个单词的首字符转换为大写

更多相关知识,请访问 PHP中文网!!

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