title: First time using classes - class not found
body: <p>So what I thought was going to be a simple 50 odd lines of code has grown into something quite a bit bigger than anything I've ever worked on before and I've decided to move my code into classes.</p>
  
  <p>This is a first for me, so I'm not 100% on how the new structure is supposed to fit together...</p>
  
  <p>So I've created a class called weather in <code>weather.php</code>:</p>
  
  <pre><code>class weather
  {
      // various variables and functions like getWeather() go here
  }
  </code></pre>
  
  <p>I'm referencing it in my index.php as follows:</p>
  
  <pre><code>require_once("weather.php");
  
  // instantiate the weather class.
  $w = new weather();
  
  // get the weather by calling the getWeather() function
  $weather = $w-&gt;getWeather();
  </code></pre>
  
  <p>Based on what I'm understanding about what I've seen on SO and other sites (been to the PHP manual too), this should work, however, I keep getting this error:</p>
  
  <blockquote>
    <p>Fatal error: Class 'weather' not found in C:\usbwebserver\root\weather\index.php on line 4</p>
  </blockquote>
  
  <p>Line 4 is where I declare the class in <code>$w</code>.</p>
  
  <p>I'm not sure what I've done wrong here, can someone explain it to me?</p>
  
  <p><strong>EDIT</strong><br>
  Adding an echo to the top of <code>weather.php</code> before the class didn't seem to write anything to the browser, however, what is being written to the browser appears to be code that exists within the class...</p>