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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
siefkencp
Forum Commoner
Posts: 69
Joined: Thu Dec 16, 2004 8:50 am

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

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The line

Code: Select all

$this->compareDay; = $this->compareArray&#1111;1];
has an extra semicolon before the =. Delete it :wink:
siefkencp
Forum Commoner
Posts: 69
Joined: Thu Dec 16, 2004 8:50 am

Post by siefkencp »

DOH! :oops: thanks, sorry for the silly mistake.
siefkencp
Forum Commoner
Posts: 69
Joined: Thu Dec 16, 2004 8:50 am

Post 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
Post Reply