Static ile kısa kullanım yöntemi
<?php
class durgun{
static function birlestir($isim,$soyisim) {
echo $isim.' '.$soyisim;
}
}
durgun::birlestir("Acun","Ilıcalı");
?>
Public ile zincirleme kullanım yöntemi
<?php class genel {
public $adi;
public $soyadi;
public function adi($adi) {
$this->adi = $adi;
return $this;
}
public function soyadi($soyadi) {
$this->soyadi = $soyadi;
return $this;
}
public function birlestir() {
echo $this->adi.' '.$this->soyadi;
}
}
$b=new genel;
$b->adi('Acun')->soyadi('Ilıcalı')->birlestir();
?>
