PHP For循环字母A-Z当超过26个字母时输出AA,AB,AC
作者:mdxy-dxy 时间:2023-10-07 08:09:10
php循环输出26个大小写英文字母
for($i=65;$i<91;$i++){
echo strtolower(chr($i)).' ';//输出小写字母
echo strtoupper(chr($i)).' ';//输出大写字母
}
PHP For循环字母A-Z当超过26个字母时输出AA,AB,AC
for ($i = 0; $i <= 1000; $i++) {
$y = ($i / 26);
echo $i,"=>";
if ($y >= 1) {
$y = intval($y);
echo chr($y+64);
echo chr($i-$y*26 + 65);
} else {
echo chr($i+65);
}
echo "\r\n";
}
这里就完成了,经过测试确实不错,原理就是通过php的chr() 函数从指定 ASCII 值返回字符。
具体的资料可以查看这篇文章:https://www.aspxhome.com/article/156073.htm
来源:http://rainyin.com/3874.html
标签:PHP,For,字母,A-Z
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
讲解Python3中NumPy数组寻找特定元素下标的两种方法
2023-07-17 09:58:42
![](https://img.aspxhome.com/file/2023/0/65540_0s.png)
PHP引用(&)各种使用方法实例详解
2023-11-01 18:12:43
python中playwright结合pytest执行用例的实现
2022-12-13 14:28:58
Django与JS交互的示例代码
2023-05-03 13:38:58
![](https://img.aspxhome.com/file/2023/1/107561_0s.png)
Python数据可视化之Pyecharts使用详解
2022-10-19 17:31:12
![](https://img.aspxhome.com/file/2023/3/67783_0s.png)
IE里模拟DOMContentLoaded事件
2008-08-05 17:12:00
python模型集成知识点总结
2023-08-03 00:16:16
Mysql环境变量配置方式
2024-01-25 22:41:30
![](https://img.aspxhome.com/file/2023/8/122918_0s.png)
使用python模块plotdigitizer抠取论文图片中的数据实例详解
2023-07-14 01:50:52
![](https://img.aspxhome.com/file/2023/9/127099_0s.png)
浅谈PHP中的Trait使用方法
2023-11-08 09:25:33
![](https://img.aspxhome.com/file/2023/8/55738_0s.png)
Python标准异常和异常处理详解
2021-02-23 05:10:36
仿谷歌主页js动画效果实现代码
2024-04-17 10:07:36
Python实现视频裁剪的示例代码
2022-07-20 07:14:14
![](https://img.aspxhome.com/file/2023/3/85373_0s.png)
Python检测和防御DOS攻击的最简单方法
2022-04-12 17:23:19
![](https://img.aspxhome.com/file/2023/1/79551_0s.jpg)
在Pycharm terminal中字体大小设置的方法
2023-11-12 07:12:56
用CSS制作兼容多浏览量器的隐藏菜单
2007-08-30 09:05:00
MySQL百万级高并发网站实战攻略
2009-03-25 15:49:00
ASP与Excel结合生成数据表和Chart图的代码
2011-03-08 10:50:00
Python基于BeautifulSoup爬取京东商品信息
2021-03-15 21:52:53
![](https://img.aspxhome.com/file/2023/6/72256_0s.jpg)
Win11平台安装和配置NeoVim0.8.2编辑器搭建Python3开发环境详细过程(2023最新攻略)
2023-06-06 21:28:07
![](https://img.aspxhome.com/file/2023/1/111871_0s.png)