Send to a Friend

frankielaguna's avatar

Referencing a class from another class [PHP]?

Asked by frankielaguna (256points) November 14th, 2008

Hi! I’m trying to find out the best way to reference a class from within another class, IE: I have a base class called base, and I have a users class called users,

Within users theres: _uidToUname() which uses $this->_userExists();

I want to be able to use _uidToUname from Base.

Now If I do:
Users::_uidToUname(1); I get a, “Can’t use $this” error.

I don’t necessarily want to extend base to users.

Is there another way, or which is the best method to use?

Thanks!

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.