Expanding my php stuff and im wondering if php can do packages like that of java when you create muilple class and associations.
In Java you would have
package packagename;
import person;
public class bankCustomer extends person {
}
Where the package would allow access to many files and you import what you need
Or do i just keep to what I am doing...
Either lots of import lines
OR
Sometimes i make a file that has relevent stuff
Say part of the site deals with user comments in a blog etc away from its gallery code
You have all the files relevent
so you import database, import person, comments, display, imput blabla
Then when ever your calling its use you import just the one file
Yes it can, google for php inheritance
Hi m8, yeah, allready know about inheritance
But i cant see from things on web about how to use them
From a person to a student do you just say "extends person" and it will look for the class file of that object or do you need to do..
include person
As i was asking if you could just declare a package and use whats in it,c ant find anything on that
oic what you mean :)
No, afaik there is no way to pre-complie PHP classes into libraries. You have to link them up manually.
require_once("parent.php");
class child extends parent {
}
Just confirming, the answer is no.
PHPs OO stuff is fairly um... basic. Its has only just learned about public and private functions.
... back to doing what have been doing.
Cornet
This is why PHP is crap for large scale development. The compiled source code for my software is 3.25mb. 1395 files (I just checked), imagine trying to link all them together in a meaningful way in PHP.
I found you can do this actually.
You give a name to your project amd have a simple front controller and you just place the name of the project in each file, certain files you direct include for privacy but all have the package assoication.
Its a hack nothing more.