How could a repeat of a variable be repeated several times.
To better understand this issue, it would be if I said:
$foo = '<div>bar</div>'; echo $foo*7;
This is probably the easiest thing, but I'm not sure.
AND
In this simple case, you can use str_repeat() .
str_repeat()
$foo = '<div>bar</div>'; echo str_repeat($foo, 7);
Link: PHP String Functions
For something more complex, a loop is usually a transition method.
Do not propagate lines. You can do it manually:
echo $variable; echo $variable; echo $variable; echo $variable; // etc
Or in a for loop:
for($z=0;$z<10;$z++){ echo $variable; }
Or str_repeat:
echo str_repeat($variable, 10);
Use str_repeat() .
echo str_repeat($foo, 7);
for ($i = 0, $i <= 7, $i++) { echo $foo; }
Use the for loop .....................
for
http://php.net/manual/en/control-structures.for.php
Source: https://habr.com/ru/post/1336728/More articles:python: sorting two polygon lists for intersections - pythonT-SQL query to get the number of days when an item was at the current price - sqlOption Types Ocaml - ocamlMaintain an ordered collection of objects - c ++SQL Server 2008 OPENROWSET Release Permission Issued - securityBoost Asio deadline_timer on an Android device does not start when it expires, but at a later point in time - c ++Embedding OpenID user information - phpLouis idioms compiled in one place - luaProlog time comparison - prologUsing a dispatcher in a module-verified MVVM module - multithreadingAll Articles