title: How to define an Array property in a PHP class
body: <p>I have a following simple code but it produces syntax error on line <code>this-&gt;players[] = 'Tom'</code>:</p>
  
  <pre><code>    &lt;?php
  
      class club {
              var $clubID = 0;        
              var $players=array();
  
              function __constructor($clubID = '') {              
                       $this-&gt;clubID = $clubID;
              } 
  
              function populatePlayers() {    
                       $this-&gt;players[] = 'Tom';
              }                                           
  }
  
         $myClub = new club(1);
         $myClub-&gt;populatePlayers();
         var_dump($myClub-&gt;players);
  ?&gt;
  </code></pre>