There is a function in PHP: String str_repeat($str, num); it is very easy to use.... The following is implemented through js and php simulation.
1: PHP version
Copy code The code is as follows:
/*PHP version implementation*/
function repeat($str, $num){
return implode( $str, array_fill(0, $num+1, '') );
}
2: JavaScript implementation:
Copy code The code is as follows:
/*JavaScript implementation*/
function repeat(str, num ){
return new Array( num + 1 ).join( str );
}
http://www.bkjia.com/PHPjc/313625.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313625.htmlTechArticleThere is a function in PHP: String str_repeat($str, num); It is very easy to use....The following Implemented through js and php simulation. 1: PHP version Copy code The code is as follows: /*PHP version implementation*/ function repeat($str...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn