title: PHP Class arguments in functions
body: <p>I'm having trouble using an argument from my class in one of that class's functions.</p>
  
  <p>I have a class called company: </p>
  
  <pre><code>class company {
  
     var $name;
  
     function __construct($name) {
        echo $name;
     }
  
     function name() {
        echo $name;
     }
  }
  
  $comp = new company('TheNameOfSomething');
  $comp-&gt;name();
  </code></pre>
  
  <p>When I instantiate it (second to last line), the construct magic method works fine, and echos out "TheNameOfSomething." However, when I call the name() function, I get nothing.</p>
  
  <p>What am I doing wrong? Any help is greatly appreciated. If you need any other info, just ask!</p>
  
  <p>Thanks<br>
  -Giles<br>
  <a href="http://gilesvangruisen.com/" rel="nofollow noreferrer">http://gilesvangruisen.com/</a></p>