Simple class declaration returns error
| From: | Dave M G | Date: | Wed, 14 Jun 2006 16:22:57 +0000 |
| Subject: | Simple class declaration returns error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237981@lists.php.net to get a copy of this message | ||
PHP List,
I am in the preliminary stages of designing my first object oriented PHP based web site.
I've created file called "article.class" and included it in my index.php file. I put in a very simple echo statement, just as a place marker before I put in the real code, and just to make sure that the index.php file is successfully including the class.
So far, it just looks like this (including line numbers):
4. class article{
5. public function edit(){
6. echo "test";
7. }
8. }
However, when I view my index.php, it says:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /web/article.class on line 5
Of course I consulted the PHP manual to make sure that I had the class syntax correct, and it seems that I've followed the basic structure as described there.
Where have I gone wrong?
Thank you for any advice.
--
Dave M G