-2

How can I achieve making words loops without any space between them using for

Here is my code:

function a($var) {
    for ($i = 0; $i < ; $i++)
    {
        echo "a";
    }
}

a(3);

I want it to make loops like:

a(3);

output: aaa

but I get an error saying

syntax error, unexpected ';'
not_a_student
  • 31
  • 1
  • 1
  • 5

1 Answers1

3

Syntax Error

I think you are missing a limiting factor if for loop

for ($i = 0; $i < ; $i++)

should be

for ($i = 0; $i < $some_limiting_factor_here; $i++)

in your case $some_limiting_factor_here could be $var

Arbaz Khan
  • 80
  • 8