Üstadlar php'de Class olayına yeni yeni giriş yapıyorum yalnız şöyle bi durumla karşılaştım. alttaki gibi basit bir sınıf oluşturdum sorgu değerini destruct çıkış fonksiyonunda döndürüyorum yalnız değeri kullanamıyorum
Catchable fatal error: Object of class DB could not be converted to string
böyle bir hata alıyorum sebebi nedir yardımcı olacak arkadaşlara şimdiden teşekkürler
class DB
{
private $sorgu,$select,$from,$where;
public function select($deger){
$this->select=$deger;
}
public function from($deger){
$this->from=$deger;
}
public function where($deger){
$this->where=$deger;
}
function __destruct(){
$this->sorgu="select ".$this->select." from ".$this->from." where ".$this->where;
return $this->sorgu;
}
}