title: Catchable fatal error: Object of class dayDaytimeFields could not be converted to string
body: <p>I am trying to render a part of a table using a self created object. 
  When trying to access the method in the class I get:</p>
  
  <blockquote>
    <p>Catchable fatal error: Object of class dayDaytimeFields could not be
    converted to string in /Applications/MAMP/[...]/test.php on line 85</p>
  </blockquote>
  
  <p>Line 85 is:</p>
  
  <pre><code>$testObj-&gt;renderFields();
  </code></pre>
  
  <p>This is my code:</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>&lt;table class="table table-striped table-bordered table-hover"&gt;
    &lt;caption&gt;Week Planner&lt;/caption&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;&lt;/th&gt;
        &lt;th&gt;Breakfast&lt;/th&gt;
        &lt;th&gt;Lunch&lt;/th&gt;
        &lt;th&gt;Dinner&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
  
      &lt;?php
          class dayDaytimeFields {
  
              public $dayDaytime;
  
              public $week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
              public $weekShort = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
  
              public $dayTime = ['Breakfast', 'Lunch', 'Dinner'];
              public $dayTimeShort = ['BrF', 'Lun', 'Din'];
  
              public function renderFields() {
  
                  for ($i = 0; $i &lt; count($this-&gt;$week); $i++) {
  
                      echo "&lt;tr&gt;&lt;th&gt;" . $this-&gt;$week[$i] . "&lt;/th&gt;";
  
                      for ($j = 0; $j &lt; count($this-&gt;$dayTime); $j++) {
                          $this-&gt;dayDaytime = $this-&gt;$weekShort[$i] . $this-&gt;$dayTimeShort[$j];
                          echo "&lt;td&gt;&lt;input type='text' name='" . $this-&gt;dayDaytime . "' id='" . $this-&gt;dayDaytime . "'&gt;&lt;/td&gt;";
                      }
  
                      echo "&lt;/tr&gt;";
                  }
              }
          }
      ?&gt;
  
      &lt;?= 
        $testObj = new dayDaytimeFields();
        $testObj-&gt;renderFields(); 
      ?&gt;
  
    &lt;/tbody&gt;
  &lt;/table&gt;         
  </code></pre>
  
  <p>This is my first step into OOP, so any further input (i.e. how to improve the code) is highly appreciated :-)             </p>