Quote:
|
make one file that have more than one function , each function draw a form and one filr have more than one function , each function contact with database ..... the two file are too big not in size but in command lines
|
I wouldn't do that. I would create seperate files wich contains those functions. For example, all database connection related functions are in database.php. All form functions are in forms.php. This way you can find your functions much faster and you cannot alter up any other functions by accident. So for example you're working on the database php file, you cannot alter the forms php file.
Quote:
|
when i make a "function" and when i make a "class"
|
Nowaydays I stuff everything in a class. Why? This way I can find my functions even faster.
Let's just say you have a Forms class. All the functions are in forms.class.php (already by the php file name I can see it's a class). So somewhere in your code you have something like
And when you want to use it:
Now, this tells me, $form is a instance of the class Forms. So I must have a php file who has that class and in this case it is forms.class.php (I usually name the php file the same as the classname, but lowercased). So when I need to alter the function doAfunction() I just open forms.class.php
And even when you don't know wich file it was, just search all php files on
class Forms
and you'll get 1 hit (usually), because you can only have one class with the same name.
Also putting your functions in a class is also handy because of the inheritance (for example class B extends class A).