I am in Ubuntu 11.10. When I write a simple script like echo phpinfo();
it runs and shows no error. But if I try to write some extra php code the browser server error page. What is the issue here I dont understand ??
Lets say if I change the code to the following it gives server error;
<?php
class MyClass{
private $prop;
public function __construct(){
echo "The class \"".__CLASS__."\"was created";
}
public function __destruct(){
echo "The class \"".__CLASS__."\" was destroyed";
}
protected function getProperty(){
return $prop;
}
public function __toString(){
echo "__toString() method called.<br />";
return $this->getProperty().'<br />';
}
public function setProperty($prop){
$this->prop = $prop;
}
}
class MyOtherClass extends MyClass{
public function __construct(){
parent::__contruct();
echo "A new constructor in class \"".__CLASS__"\"";
}
public function newMethod(){
echo 'From a new method in class '.__CLASS__.'<br />';
}
}
$newClass = new MyOtherClass();
echo $newClass->getProperty();
?>