Re: Classes and Functions
| From: | Manish Marathe | Date: | Thu, 03 Nov 2005 00:01:59 +0000 |
| Subject: | Re: Classes and Functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225007@lists.php.net to get a copy of this message | ||
On 11/2/05, Unknown Unknown <phpinfolist@gmail.com> wrote:
>
> Hi everybody i have a class that i reference with:
> $DB= new DBInterface;
> outside a function it works fine, but using $DB inside a function changes
> the data type i think... i get an error saying i'm using a method on a
> non-object...
> any help appreciatted
if you mean by "inside a function", a method of your class DBInterface then
you can can use $this. Otherwise you can do something like:
$DB= new DBInterface();
and then I believe you should be able to use $DB at it is.