【发布时间】:2014-09-17 10:25:00
【问题描述】:
$variable = "test_company_insurance_llc_chennai_limited_w-8tyu.pdf";
我需要在$变量上方显示
Test Company Insurance LLC Chennai Limited W-8TYU.pdf
为此我已经完成了:
$variable = str_replace("_"," ","test_company_insurance_llc_chennai_limited_w-8tyu.pdf");
$test = explode(" ", $variable);
$countof = count($test);
for ($x=0; $x<$countof; $x++) {
if($test[$x] == 'w-8tyu' || $test[$x] == 'llc') {
$test[$x] = strtoupper($test[$x]);
//todo
}
}
我被困在待办事项部分。
我将使用 strtoupper 将特定单词更改为大写。
稍后,我应该如何合并数组?
任何帮助将不胜感激......
【问题讨论】:
-
implode() 函数的作用与爆炸相反:它将数组元素作为字符串粘合在一起。
-
您也可以使用
ucfirst()仅更改字符串中第一个字母的大小写:php.net/manual/en/function.ucfirst.php
标签: php arrays for-loop case-sensitive