[英]PHP concat a string into a variable x amount of times
I am trying to create a variable that has a string repeated x amount of times depending on what $tagtime3 = 我正在尝试创建一个变量,该变量的字符串重复x次,具体取决于$ tagtime3 =
This is what I have so far: 这是我到目前为止的内容:
$tagtime = $length / $overlaylength;
$tagtime3 = floor($tagtime);
$stringtoloop = "' . $tagmp3 . '";
for ($k = 0 ; $k < $tagtime3; $k++){ $finalstring = +.$stringtoloop; }
I think it could be done by pushing the string ' . 我认为可以通过按下'。 $tagmp3 . $ tagmp3。 ' into a variable within the loop. '放入循环中的变量。
Maybe just str_repeat($stringtoloop,$tagtime3);
也许只是str_repeat($stringtoloop,$tagtime3);
? ?
I just discovered str_repeat this will repeat the string n amount of times: 我刚刚发现str_repeat这将重复字符串n次:
$tagtime = $length / $overlaylength;
$tagtime3 = floor($tagtime);
$stringtoloop = "' . $tagmp3 . '";
$test = str_repeat($stringtoloop, $tagtime3);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.