【发布时间】:2015-12-11 14:15:33
【问题描述】:
我有这个词:
katii
但我想要大写的第一个字符K。我该怎么做?
【问题讨论】:
-
使用ucfirst函数php.net/manual/ru/function.ucfirst.php
-
尝试使用 ucfirst();
-
启动谷歌 ....
我有这个词:
katii
但我想要大写的第一个字符K。我该怎么做?
【问题讨论】:
使用函数usfirst
string ucfirst ( string $str )
【讨论】:
你可以按照php.net的规定使用下面的
<?php
$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
【讨论】:
$upper = strtoupper(substr('katii', 0, 1)); //K
不过,你以后应该把你的问题说得更清楚一点。
【讨论】: