title: passing variable to a php class
body: <p>I am a beginner in php. and trying to work with Oauth. but this is not the point. the point is following: I have an Oauth class, there are four functions which return urls like this:</p>
  
  <pre><code>class tOauth{
      ......
      function accessTokenURL()  {
          return 'http://api.twitter.com/oauth/access_token'; 
      }  
      function authenticateURL() { 
          return 'http://api.twitter.com/oauth/authenticate'; 
      } 
      ......
  }
  </code></pre>
  
  <p>this works fine. but now I want these functions to be generic, such that they are suitable for any social sites. this means I have to danymically pass all urls and return them at run time. so I come up something like this:</p>
  
  <pre><code>class tOauth{
      ....
      public $accessTokenURL,$authenticateURL;
      function accessTokenURL()  {
          return $this-&gt;accessTokenURL; 
      }  
      function authenticateURL() { 
          return $this-&gt;authenticateURL; 
      } 
      ....
  }
  </code></pre>
  
  <p>and at run time I call them like this:</p>
  
  <pre><code>$oauth=new Oauth(key,secret);
  $oauth-&gt;accessTokenURL='http://www.facebook.com/oauth/access_token';
  $oauth-&gt;authenticateURL='http://www.facebook.com/oauth/authenticate';
  $token=$oauth-&gt;requestToken($someurl);    
  </code></pre>
  
  <p>but for some reason, this doesn't seems to work. I did not change anything else. it seems I can not daynamically assign variables like this. does any body know what may be the problem? thanks for any tips.</p>
  
  <p><strong>Update:</strong> whole sample code can be find here: <a href="https://github.com/abraham/twitteroauth/blob/master/twitteroauth/twitteroauth.php" rel="nofollow">https://github.com/abraham/twitteroauth/blob/master/twitteroauth/twitteroauth.php</a></p>