I am getting the error \"Undefined variable: interval in C:\\wamp\\www\\DGC\\classes\\DateFilter.php\"
Here is my code for the DateFilter class:
clas
You have to use $this->interval to access the member variable interval in PHP. See PHP: The Basics
class DateFilter extends Filter
{
private $interval; // this is correct.
public function DateFilter($daysOld)
{
$this->interval = new DateInterval('P'.$daysOld.'D'); // fix this
}
function test()
{
echo $this->interval->format("%d days old "); // and fix this
}
}