开发者

PHP string functions

开发者 https://www.devze.com 2023-01-10 02:56 出处:网络
is there any other way to print 40 dots in php? i have this in my mind but i think this is wrong.. maybe there was a way like this.

is there any other way to print 40 dots in php?

i have this in my mind but i think this is wrong.. maybe there was a way like this.

<?php print(".",40);  ?>

is it possible to do 开发者_StackOverflowin that way? without the use of looping..?


Yes ! use the str_repeat function:

echo str_repeat('.', 40);


If you don't want to use any loop then the PHP function str_repeat() will work correctly here. Another approach is to do this by the use of arrays.

0

精彩评论

暂无评论...
验证码 换一张
取 消