For example, I want the string "aaa" multiplied by the number 3 , so that it is "aaaaaaaaa" .

But instead, "aaa" converted to a number (ie, 0 ), then multiplied.

Explicitly specifying the type does the same thing: (string)"aaa"*(int)3 outputs 0 .

Is it possible to increase a line several times by multiplication?

  • It is impossible. And exponentiation is also impossible. And the division operation to divide the line in half, too, is impossible! Pichalka ... - PinkTux
  • @PinkTux how about row factorial? ) - Nick Volynkin

1 answer 1

It is clear that you can not multiply the string.
Use str_repeat :

 var_dump(str_repeat("aaa", 3)); // string(9) "aaaaaaaaa"