title: php constructor variable not getting accessed in the functions below
body: <p>I have initialized a new instance of a library in the __construct(){} method of a PHP class and equated it to a variable, </p>
  
  <p>but now I want to use this variable to access methods of the library inside another function but PHP is not allowing me do that. </p>
  
  <pre><code>class Demo 
  {
  
  public function __construct()
      {
  
      parent::__construct(new PaymentModel);
  
      $this-&gt;api = new Api(config("razorpay", "key_id"), config("razorpay", "key_secret"));
  
      }
  
  public function createOrder()
    {
      $order = $api-&gt;order-&gt;create();
      echo '&lt;pre&gt;';
      var_dump($order); die;
  
    }
  }
  </code></pre>
  
  <p>I looked at the __construct documentation and some other answers here on stack overflow but all they did was confuse me more than helping me out. </p>
  
  <p>Please help me figure this out as I am a starter myself in tech.</p>