title: PHP: How to Create Object Variables?
body: <p>So for example I have this code:</p>
  
  <pre><code>class Object{
      public $tedi;
      public $bear;
      ...some other code ...
  }
  </code></pre>
  
  <p>Now as you can see there are public variables inside this class. What I would like to do is to make these variables in a dynamic way, with a function something like:</p>
  
  <pre><code>private function create_object_vars(){
  
     // The Array what contains the variables
     $vars = array("tedi", "bear");
  
     foreach($vars as $var){
        // Push the variables to the Object as Public
        public $this-&gt;$var;
     }
  }
  </code></pre>
  
  <p>So how should I create public variables in a dynamic way?</p>