Page 1 of 1

[SOLVED] can some one help me figure out an error?

Posted: Thu Mar 03, 2005 10:56 am
by siefkencp
I get an error that says...

Parse error: parse error in /class.compare_date_time.php on line 14

Fatal error -- Cannot instantiate non-existent class: comparedate in /classtest.php on line.

classtest.php

Code: Select all

#!/usr/bin/php -q
<?
require_once('class.compare_date_time.php');

$newcompare = new compareDate;
$newcompare->daysAgo(15);
$newcompare->displayVars();
?>
The actual class:

Code: Select all

<?
class compareDate &#123;
        var $compDate;
        var $compareMonth;
        var $compareDay;
        var $compareArray;
        var $delayHour;

        function daysAgo($delayDay)&#123;
                $this->delayHour = $delayDay * 24;
                $this->compDate = date("m/d/y", mktime(date("h")-$this->delayHour));
                $this->compareArray = explode("/" , $this->compDate);
                $this->compareDay; = $this->compareArray&#1111;1];
                $this->compareMonth = $this-compareArray&#1111;0];
        &#125;
        function displayVars()&#123;
                print $this->delayHour;
                print $this->compDate;
        &#125;
&#125;
?>
Thanks in advance for the help...

Chris

Posted: Thu Mar 03, 2005 11:09 am
by Chris Corbyn
The line

Code: Select all

$this->compareDay; = $this->compareArray&#1111;1];
has an extra semicolon before the =. Delete it :wink:

Posted: Thu Mar 03, 2005 12:18 pm
by siefkencp
DOH! :oops: thanks, sorry for the silly mistake.

Posted: Thu Mar 03, 2005 12:27 pm
by siefkencp
Actually I get the same message... now that I have fixed the semicolon.



.... back again and added a > and it works.... thanks so much