Re: Simple simple Date class error
| From: | Alan Knowles | Date: | Sat, 26 Jul 2003 00:42:43 +0000 |
| Subject: | Re: Simple simple Date class error | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-6832@lists.php.net to get a copy of this message | ||
Stephen March wrote:
When executing the following code: <?php require_once 'Date.php'; $theDate = new Date(); $theDate -> getDate(); ?> I get the following error: Fatal error: Cannot instantiate non-existent class: date in E: \Inetpub\wwwroot\test\Date.php on line 4Since Date is a top level Class, you can not use Date as a Filename without conflicting with it. - Try renaming your test file as datetest.php your require_once 'Date.php' is including it'self.. - not the date file. Regards Alan
Makes sense, how do I instantiate the class? Any other OOP design allowsyou to define a constructor and then create an instance using the new keyword. Could somebody please write something quick and dirty as an example on how to use the class? Even a few simple lines would help. Getting this package to work has been like pulling teeth. I'm sure most of it is my own fault ... Thanks in advance! Stephen March Application Information Officer AB & NWT Region Phone: (780) 495-2831 Email: stephen_march@hc-sc.gc.ca (Embedded image moved to file: pic14798.gif)