Re: Refer to class within function?
- From: Oli Filth <catch@xxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 09:39:04 GMT
Brent wrote:
Am I supposed to get an error when I try to access a class within a function?
It's usually helpful to post details of any error messages you get on newsgroup, so people can more easily identify the problem.
E.g.:
somepage.inc.php has a class:
--------------
class myclass { myclass()
^ This syntax is wrong. It should be "function myclass()".
{
return "foo";
}
I'm assuming you want this to be the constructor. Constructors can't have return values.
Oh, and if you're using PHP 5, use __construct as the name of the constructor function.
-- Oli .
- References:
- Refer to class within function?
- From: Brent
- Refer to class within function?
- Prev by Date: thread-safe story
- Next by Date: Re: Php sessions
- Previous by thread: Refer to class within function?
- Next by thread: thread-safe story
- Index(es):
Relevant Pages
|