Ben basit bir sınıf yazıyordu. İşte kod:
class Book{
var $title;
var $publishedDate;
function Book($title, $publishedDate){
$this->title = $title;
$this->publishedDate = $publishedDate;
}
function displayBook(){
echo "Title: " . $this->title . " published on " . $this->publishedDate . "";
}
function setAndDisplay($newTitle, $newDate){
$this->title = $newTitle;
$this->publishedDate = $newDate;
echo "The new information is of the book <b>" . $this->displayBook() . "</b><br />";
}
}
Ve ben sınıfını başlatıldı ve fonksiyon denir:
$test = new Book("Harry Potter", "2010-1-10");
$test->setAndDisplay("PHP For Beginners", "2010-2-10");
Ve sonuç:
"Title: PHP For Beginners published on 2010-2-10The new information is of the book"
Olmamalı:
"The new information is of the book **Title: PHP For Beginners published on 2010-2-10**
Herkes açıklayabilir misiniz?