Php question for the wise

  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

I have this class A

i've been coding a lot of the functionality of it, which could get grouped together

A
{

X-type functions

Y-type functions

Z - type functions

}


A is getting large, and i wante dto have some sort of includes, to cut down on the size of a

A
{
include ("yfuntions");
include ("zfuntions");
include ("xfuntions");
}


this dosent really work as i found out.. Is there a way to accomplish this?

thanks will
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • phpSelectah
  • Student
  • Student
  • User avatar
  • Posts: 97

Post 3+ Months Ago

Use inheritance. :D

Group like functions and make them into sub classes, and have them be inherited by other classes.

as
contents of file.php :

class fileio extends master {
....
};


contents of dirio.php

class dirio extends fileio {
....
};


contents of master.php:

class master {
....
};


contents of linker.php:

include("master.php");
include("fileio.php");
include("dirio.php");


and in your calling page:

include("linker.php");


:D
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

... yah i figred

that would prolly require me to revamp my code... I just had some outdated crap that wasnt really getting used, i kinda watned to shrink my file size down withouht losing the stuff.....

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 66 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.