title: Multidimensional array to object, specific way
body: <p>I know this type of question has been asked a lot, but I haven't found out how to do it like I want it to be.</p>
  
  <p>So, basically I have this array.</p>
  
  <pre><code>array(7) {
    ["site"]=&gt;
    array(5) {
      ["production"]=&gt;
      bool(false)
      ["url"]=&gt;
      string(29) "http://localhost/"
      ["name"]=&gt;
      string(6) "Sitename"
      ["title"]=&gt;
      string(7) ": Index"
      ["pagedata"]=&gt;
      array(1) {
        ["default"]=&gt;
        string(5) "Index"
      }
    }
    ["DB"]=&gt;
    array(5) {
      ["host"]=&gt;
      string(9) "localhost"
      ["user"]=&gt;
      string(4) "root"
      ["pass"]=&gt;
      string(4) "secret"
      ["database"]=&gt;
      string(12) "database"
      ["engine"]=&gt;
      string(7) "eMySQLi"
    }
    ["cache"]=&gt;
    array(2) {
      ["file"]=&gt;
      array(1) {
        ["time"]=&gt;
        int(500)
      }
      ["memcache"]=&gt;
      array(2) {
        ["my_first_vps_ip"]=&gt;
        string(17) "my_first_vps_port"
        ["my_second_vps_ip"]=&gt;
        string(18) "my_second_vps_port"
      }
    }
    ["skin"]=&gt;
    array(2) {
      ["name"]=&gt;
      string(9) "thehabbos"
      ["mobile"]=&gt;
      array(2) {
        ["enabled"]=&gt;
        bool(true)
        ["name"]=&gt;
        string(16) "mobile_thehabbos"
      }
    }
    ["lang"]=&gt;
    array(1) {
      ["name"]=&gt;
      string(7) "English"
    }
    ["widget"]=&gt;
    array(1) {
      ["default"]=&gt;
      string(7) "Icecron"
    }
    ["cron"]=&gt;
    array(1) {
      ["DatabaseBackup"]=&gt;
      array(1) {
        ["execute_every"]=&gt;
        int(86400)
      }
    }
  }
  </code></pre>
  
  <p>So, if I 'parse' this array ( convert the array into an object ) with a method like this one..</p>
  
  <pre><code>    private function parse($arr)
      {
          foreach ($arr as $key =&gt; $val) 
          {
              $this-&gt;{$key} = is_array($val) ? $this-&gt;parse($val) : $val;
          }
          return $this;
      }
  </code></pre>
  
  <p>I'll end up with something like...</p>
  
  <pre><code>object(Configure)#3 (27) {
    ["production"]=&gt;
    bool(false)
    ["url"]=&gt;
    string(29) "http://localhost/RevFramework"
    ["name"]=&gt;
    string(7) "English"
    ["title"]=&gt;
    string(7) ": Index"
    ["default"]=&gt;
    string(7) "Icecron"
    ["pagedata"]=&gt;
    *RECURSION*
    ["site"]=&gt;
    *RECURSION*
    ["host"]=&gt;
    string(9) "localhost"
    ["user"]=&gt;
    string(4) "root"
    ["pass"]=&gt;
    string(4) "root"
    ["database"]=&gt;
    string(12) "rev_database"
    ["engine"]=&gt;
    string(7) "eMySQLi"
    ["DB"]=&gt;
    *RECURSION*
    ["time"]=&gt;
    int(500)
    ["file"]=&gt;
    *RECURSION*
    ["my_first_vps_ip"]=&gt;
    string(17) "my_first_vps_port"
    ["my_second_vps_ip"]=&gt;
    string(18) "my_second_vps_port"
    ["memcache"]=&gt;
    *RECURSION*
    ["cache"]=&gt;
    *RECURSION*
    ["enabled"]=&gt;
    bool(true)
    ["mobile"]=&gt;
    *RECURSION*
    ["skin"]=&gt;
    *RECURSION*
    ["lang"]=&gt;
    *RECURSION*
    ["widget"]=&gt;
    *RECURSION*
    ["execute_every"]=&gt;
    int(86400)
    ["DatabaseBackup"]=&gt;
    *RECURSION*
    ["cron"]=&gt;
    *RECURSION*
  }
  </code></pre>
  
  <p>So, like that I could use it like this..</p>
  
  <pre><code>echo $this-&gt;url;
  </code></pre>
  
  <p>But what I want to do, is use it like this..</p>
  
  <pre><code>echo $this-&gt;site-&gt;url;
  </code></pre>
  
  <p>Any idea on how I could accomplish this, if possible?</p>