我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

php首字母大写[关闭]

I have this echo:

<?=$item['Field']?> 

I'm trying to get every 1st letter capitalized.

I tried this

<?$item = ucwords(strtolower('Field'));?>

Help would be greatly appreciated

Try that:

<?$item_capitalize = ucwords(strtolower($item['Field']));?>

I think you want one of the following

<?= $item[ucwords(strtolower('Field'))]; ?>
<?= ucwords(strtolower($item['Field'])); ?>

If you want to print it, don't assign it.

<?=ucwords(strtolower($item['Field']));?>

近期文章

  • 将此MySQL_ *转换为PDO [关闭]
  • 可能的倍数回报?
  • 使用PHP的长浮点数
  • 记事本到VIM复制/粘贴代码[关闭]
  • PHP语法错误,意外';' [关闭]
  • 重定向没有index.php的URL [重复]
  • 按表格更新数据库[关闭]
  • 如何将CSS类或ID挂钩到PHP中的元素[关闭]
  • 查找日期是未来还是不[关闭]
  • 功能mail()[关闭]
  • 如果存在,Php重定向到变量
  • 在第4行'ORDER BY date DESC LIMIT 1'附近使用的正确语法[关闭]
  • 将PHP传递给Javascript [关闭]
  • var_dump to string [关闭]
  • 非法字符串偏移,如何使用此数据[关闭]
  • 如何在php或javascript中为数字着色[关闭]
  • 什么是正确的PDO语法[重复]
  • 如何找到x2和y2 [关闭]
  • 从MYSQL表中提取没有时间的日期[复制]
  • 将一些文字发布到??? 监控[关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华