Object of class set could not be converted to string
<p>this is my php code</p>

<pre><code>&lt;?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

class stripeContact{
    public $ID;
    public $amount;
    public $amount_refunded;
    public $currency;
    public $profileName;
    public $profileID;
    public $fingerprint;
    public $cardEmail;
    public $createDate;
    public $description;
    public $paymentID;
    public $logID;

}

class set{
    private $stripeOb;

    function __construct($input){
        $input = (array) $input;
        var_dump($input);
        $this-&gt;stripeOb = new stripeContact();
        $this-&gt;stripeOb-&gt;ID = $input["id"];
        $this-&gt;stripeOb-&gt;amount = $input["amount"];
        $this-&gt;stripeOb-&gt;amount_refunded = $input["amount_refunded"];
        $this-&gt;stripeOb-&gt;description = $input["description"];
        $this-&gt;stripeOb-&gt;logID = "-999";
    } 

    public function stripe(){
        return new log($this);
    }
}

class log{
    private $dbTableName = "stripeLog";
    private $client;

    function __construct($client){
        $this-&gt;$client = $client;
    }

    public function save(){
    // save to sql code
    }
}
?&gt;
</code></pre>

<p>and in another php class im calling class <strong>set</strong> like this.</p>

<pre><code>$stripe = new set($onlinePay);
$resStripe = $stripe-&gt;stripe()-&gt;save();
</code></pre>

<p>when i am calling this im getting this error </p>

<pre><code>Catchable fatal error&lt;/b&gt;:  Object of class set could not be converted to string in 
</code></pre>

<p>this error occur in this line </p>

<pre><code>function __construct($client){
    $this-&gt;$client = $client;
}
</code></pre>

<p>what am i doing wrong. im passing whole <strong>set</strong> class instance to constructor in log class.  </p>