title: PHP for loop only runs once
body: <p>I've been taking the php course from code academy. In one of the exercises, i've tried to implement a conditional function, where it would take a parameter for how many times the function would run. Unfortunately it is not running. I'm trying to run the bark() twice with bark(2). It's only echoing once. I have tried a "do while", "if" and "for". None worked. Why is that? </p>
  
  <pre><code>&lt;?php
     class Dog{
          public $numLegs = 4;
          public $name;
          public $speak = "Woof!";
    public function bark($up){
        $counter = 0;
        for($counter; $counter!=$up;$counter++){
        return $this-&gt;speak;
        }
    }
  
    public function greet(){
        return "Hello " . $this-&gt;name . "!" . "&lt;br /&gt;";
    }
  
     public function __construct($name){
         $this-&gt;name = $name;
      }
     }
     $dog1 = new Dog("Barker");
     $dog2 = new Dog("Amigo");
  
     echo $dog1 -&gt; bark(2);
     echo $dog2 -&gt; name;
  ?&gt;
  </code></pre>