title: $this->value losing, well, its value
body: <p>I have a problem with a PHP file I'm using, and I can't seem to find a solution.</p>
  
  <p>In one part of the code the value for <code>$this-&gt;value</code> is set, and the value is set correctly according to my testing.</p>
  
  <p>However, later in the same code <code>$this-&gt;value</code> is empty.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;?php
  
  class Padd_Input_Advertisement {
  
      protected $keyword;
      protected $value;
      protected $name;
      protected $description;
  
      function __construct($keyword,$name,$description='') {
          $this-&gt;keyword = $keyword;
          $this-&gt;value = unserialize(get_option($keyword));
          $this-&gt;name = $name;
          $this-&gt;description = $description;
      }
  
      public function get_keyword() {
          return $this-&gt;keyword;
      }
  
      public function set_keyword($keyword) {
          $this-&gt;keyword = $keyword;
      }
  
      public function get_value() {
          return $this-&gt;value;
      }
  
      public function set_value($value) {
          $this-&gt;value = $value;
      }
  
      public function get_name() {
          return $this-&gt;name;
      }
  
      public function set_name($name) {
          $this-&gt;name = $name;
      }
  
      public function get_description() {
          return $this-&gt;description;
      }
  
      public function set_description($description) {
          $this-&gt;description = $description;
      }
  
      public function  __toString() {
  
          $strHTML  = '';
          $strHTML .= '&lt;tr valign="top"&gt;';
          $strHTML .= '   &lt;th scope="row"&gt;&lt;label for="' . $this-&gt;keyword . '"&gt;' . $this-&gt;name . '&lt;/label&gt;&lt;/th&gt;';
          $strHTML .= '   &lt;td&gt;';
          $strHTML .= '       &lt;label for="' . $this-&gt;keyword. '_alt_desc"&gt;Short Description&lt;/label&gt;&lt;br /&gt;';
          $strHTML .= '       &lt;input name="' . $this-&gt;keyword . '_alt_desc" type="text" id="' . $this-&gt;keyword . '_alt_desc" value="' . $this-&gt;value-&gt;get_alt_desc() . '" size="80" /&gt;&lt;br /&gt;';
          $strHTML .= '       &lt;label for="' . $this-&gt;keyword. '_img_url"&gt;Image URL&lt;/label&gt;&lt;br /&gt;';
          $strHTML .= '       &lt;input name="' . $this-&gt;keyword . '_img_url" type="text" id="' . $this-&gt;keyword . '_img_url" value="' . $this-&gt;value-&gt;get_img_url() . '" size="80" /&gt;&lt;br /&gt;';
          $strHTML .= '       &lt;label for="' . $this-&gt;keyword. '_web_url"&gt;Website&lt;/label&gt;&lt;br /&gt;';
          $strHTML .= '       &lt;input name="' . $this-&gt;keyword . '_web_url" type="text" id="' . $this-&gt;keyword . '_web_url" value="' . $this-&gt;value-&gt;get_web_url() . '" size="80" /&gt;';
          $strHTML .= '       &lt;br /&gt;&lt;small&gt;' . $this-&gt;description . '&lt;/small&gt;';
          $strHTML .= '   &lt;/td&gt;';
          $strHTML .= '&lt;/tr&gt;';
          return $strHTML;
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>At the top in <code>function __construct</code>, the value is set, and I confirmed that this happens.</p>
  
  <p>However, in the bottom function <code>function  __toString</code>, <code>$this-&gt;value</code> is blank.</p>
  
  <p>Any idea what could be causing this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So, to recap, $this->value is set properly in the __construct function, but is blank in the __toString function.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>I should also mention that other variables that are set in the __construct function are working in the __toString function, like $this->keyword. It's jut $this->value that is going blank.</p>
  
  <p><strong>Edit 3</strong>
  The class is called like this </p>
  
  <pre><code>$padd_options['advertisements'] = array(
      new Padd_Input_Advertisement(
          PADD_NAME_SPACE . '_ads_125125_1',
          'Square Ad 1 (125x125)',
          'The advertisement will be posted at the side bar.'
      ),
      new Padd_Input_Advertisement(
          PADD_NAME_SPACE . '_ads_125125_2',
          'Square Ad 2 (125x125)',
          'The advertisement will be posted at the side bar.'
      ),
      new Padd_Input_Advertisement(
          PADD_NAME_SPACE . '_ads_125125_3',
          'Square Ad 3 (125x125)',
          'The advertisement will be posted at the side bar.'
      ),
      new Padd_Input_Advertisement(
          PADD_NAME_SPACE . '_ads_125125_4',
          'Square Ad 4 (125x125)',
          'The advertisement will be posted at the side bar.'
      ),
  );
  </code></pre>