PHP string functions
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.
精彩评论