How to pass a dynamic variable?
<p>Did My research on this,Couldn't find what i was looking for.</p>

<pre><code>class headerStyle{
 // now  creating our CONSTRUCTOR function
 function __construct($args=array()) {
     $this-&gt;fields = array('background','color','fontSize','backgroundUrl','imagePosition','Width','Height','backgroundSize','margin','padding','backgroundRepeat');
      foreach ($this-&gt;fields as $field) {
                $this-&gt;{"$field"} = $args["$field"];
                 }
         }
}


$style = new headerStyle(
       array(
         background =&gt;"#DEDEDC",
         color=&gt;"#F5F3F4",
         fontSize=&gt;"24px",
         backgroundUrl=&gt;"_images/bodyBg1.jpg",
         backgroundSize=&gt;"50% 50%",
         padding=&gt;"10px 0px 0px 0px",
         margin=&gt;"0px 0px 0px 0px",
         width=&gt;"100%",
         height=&gt;"60px",
         imagePosition=&gt;"top-left",
            )
);
</code></pre>

<p>instead of giving a value i need to pass a dynamic variable like background=>$_post['headerBg'];</p>
