<?php
class abhi
{
var $contents="default_abhi";
function abhi($contents)
{
$this->$contents = $contents;
}
function get_whats_there()
{
return $this->$contents;
}
}
$abhilash = new abhi("abhibutu");
echo $abhilash->get_whats_there();
?>
i've initialized variable contents a default and also constructor, why is the value not printing, anything i should correct here?
see the error,
abhilash@abhilash:~$ php5 pgm2.php
Fatal error: Cannot access empty property in /home/abhilash/pgm2.php on line 13
abhilash@abhilash:~$