title: dynamically creating array in php
body: <p>I am trying to create arrays dynamically and then populate them by constructing array Names using variable but I am getting the following warnings</p>
  
  <p>Warning: in_array() expects parameter 2 to be array, null given
  Warning: array_push() expects parameter 1 to be array, null given</p>
  
  <p>For single array this method worked but for array of arrays this is not working. How should this be done?</p>
  
  <pre><code>&lt;?php
  
  for ($i = 1; $i &lt;= 23; ++$i) 
  {
          $word_list[$i] = array("1"); 
  }
  
  
  for ($i = 1; $i &lt;= 23; ++$i) 
  {
    $word = "abc";
    $arrayName = "word_list[" . $i . "]";
    if(!in_array($word, ${$arrayName})) 
    {
      array_push($$arrayName , $word);
    }
  }
  
  
  ?&gt;
  </code></pre>