[ create a new paste ] login | about

Link: http://codepad.org/9pfqiRHu    [ raw code | output | fork ]

PHP, pasted on Nov 10:
<?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");

?>


Output:
1
The new information is of the book <b>Title: Php For Beginner published on 2010-2-10</b><br />


Create a new paste based on this one


Comments: