Re: Refer to class within function?



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
.



Relevant Pages