title: Arrays as Class Variables, Set in Constructs in Class
body: <p>Is there a way to pass an <strong>array</strong> to a class/object construct and access/return it or manipulate it?</p>
  
  <p>Code:</p>
  
  <pre><code>$affiliates = array(
          "clickbank" =&gt; "clickbankdata",
          "meepbank" =&gt; array(
                  "meepbankdata" =&gt; "meep"
          )
  );
  class Affiliate {
      public $affiliates = array();
  
      public function __construct($array) {
          $this-&gt;affiliates = $array;
      }
  
      public function getAffiliatesArray() {
          return $this-&gt;$affiliates;
      }
  }
  
  $main = new Affiliate($affiliates);
  print_r($main-&gt;getAffiliatesArray());
  </code></pre>