The str_repeat function in PHP is implemented in JavaScript. There is a function in PHP: Stringstr_repeat ($ str, num); very useful... the following is implemented through js and php simulation. 1: PHP version copy code: * PHP version * functionrepeat ($ str PHP has a function: String str_repeat ($ str, num); very useful .... the following is implemented through js and php simulation.
1: PHP version
The code is as follows:
/* PHP implementation */
Function repeat ($ str, $ num ){
Return implode ($ str, array_fill (0, $ num + 1 ,''));
}
2: JavaScript implementation:
The code is as follows:
/* JavaScript implementation */
Function repeat (str, num ){
Return new Array (num + 1). join (str );
}
Using str_repeat ($ str, num); very useful... the following is achieved through js and php simulation. 1: PHP version code:/* PHP version implementation */function repeat ($ str...