Home >Backend Development >PHP Tutorial >PHP strtoupper函数有什么用

PHP strtoupper函数有什么用

PHPz
PHPzOriginal
2016-06-13 11:41:033071browse

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中文网!!

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