How can I use include or require in class?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
destiny_cores
Forum Newbie
Posts: 8
Joined: Fri Mar 17, 2006 9:05 am

How can I use include or require in class?

Post by destiny_cores »

I have ClassA in ClassA.php and I create new class is ClassB.php. If I want import ClassA to use in ClassB.php. How I should coding?


Thank you
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

you could use the extends method

Extends PHP.net or Extends 2
destiny_cores
Forum Newbie
Posts: 8
Joined: Fri Mar 17, 2006 9:05 am

Post by destiny_cores »

But class A not relate class B. I want some method from Class A to get value. Who can help me? please...

Thanks you
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

create an instance of class a in class b.
Post Reply