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

除了第一个单词之外,将字符串数组的所有字符串都设置为小写

Supposing I have an array Tomat, Ost How can I accomplish so it is like this: Tomat, ost?

$ingredient_a = Array('Tomat', 'Ost');
echo implode(', ', $ingredient_a);

Use ucfirst and array_map with strtolower

echo ucfirst(implode(', ', array_map('strtolower',$ingredient_a)));
$ingredient_a = array('Tomat', 'Ost');
$new = array();

foreach($ingredient_a as $key => $value) {
    $key == 0 ? $new[] = $value : $new[] = strtolower($value);
}

echo implode(', ', $new);

近期文章

  • symfony内置服务器高CPU使用率
  • 仅当用户是管理员时才显示链接
  • PHP如何使URL像product.php?id = 1
  • 结合2个sql语句
  • 从文件名字符串中移除空格PHP [复制]
  • 匹配哈希包含
  • 有没有办法在MySQL中优化复杂的数学查询?
  • PHP - 使用文本字符串中的键创建数组
  • 无法删除数据库行,因为它具有外键
  • woocommerce webhook有效载荷中的自定义值
  • 查找数据数组中的下一个可用时间段
  • 是否可以在没有提交按钮的情况下验证表单?
  • 在Laravel中将数据导出到Excel
  • Laravel PHPUnit总是通过CSRF
  • PHP关联数组的平等性
  • 注销时会话结束,但数据库中没有更新..想法?
  • 为什么此登录和注册系统未正确检查密码?
  • 如何在mysql中的int之前添加零
  • 通过输入密码检查当前密码来更改yii2密码
  • 为什么调用now()会在php中失败[关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华