codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php 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 />"; } } $test = new Book("Harry Potter", "2010-1-10"); $test->setAndDisplay("Php For Beginner", "2010-2-10"); ?>
Private
[
?
]
Run code
Submit