php - 如何在 PHP 中将数字转换为单词?
问题描述
我在 PHP 中有 foreach 循环,它有诸如“one”之类的词,如下面的代码所示。我需要为每个 foreach 循环项写词。例如,“one”和第二项“two”等。
所以,我需要一个变量,它会为每个项目增加,它的值将作为单词写在 html 类中。
以最简单的方式,我该怎么做?
<?php if ( $settings['hekim_feature_list_department'] ) {
foreach ( $settings['hekim_feature_list_department'] as $item ) { ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<i class="icon-Down-2 icon-1"></i>
<i class="icon-Right-2 icon-2"></i>
<?php echo $item['hekim_feature_list_title_department'];?>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<p><?php echo $item['hekim_team_member_description_department'];?></p>
</div>
解决方案
推荐阅读
- java - 为什么我的 getTimeZone().getDisplayName 报告偏移量错误?
- xml - Google Maps API 给了我 net::ERR_ABORTED 400
- javascript - 将javascript数组元素写入文件
- python - input() 函数在哪个 Python 模块中?
- phpcs - PHPCS默认不能设置为PSR2
- javascript - 带有 Array 扩展类构造函数调用的 JS Array.prototype.filter
- java - 有没有办法检查Java在读取文本文件时是否开始读取文本文件中的新行
- kotlin - (不可变集合是可变的)在 Kotlin 中返回 true
- wordpress - 使用 woocommerce_email_actions 在地址保存上发送 WooCommerce 电子邮件
- java - 我的 GUI 无法识别我的实例方法。我怎样才能解决这个问题?