简体   繁体   English

基于变量的回显数

[英]Echo number of tabs based on variable

I am trying to create the bottom two triangles but I can't get the alignment to work properly. 我正在尝试创建底部的两个三角形,但无法使对齐正常工作。

http://imgur.com/a/IIQva http://imgur.com/a/IIQva

I can't figure out how to do the spacing properly. 我不知道如何正确进行间距。 In Python you could do ('A' * 200) and it would print the A 200 times, however I can't figure out how to do that with the \\t tab in PHP. 在Python中,您可以执行('A'* 200),它会打印A 200次,但是我无法弄清楚如何使用PHP中的\\ t选项卡。 Is it possible to do something like that so I can space out the number triangle based on tabs? 是否可以做这样的事情,以便我可以根据制表符分隔数字三角形?

您可以这样使用str_repeat函数:

echo str_repeat('Z', 4); // ZZZZ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM