3
I have a project in php
and within that project I have a folder called Funções
. Inside this folder I have several function files.
I have a file called Logado.php
, where I authenticate the user and call the pages to be loaded inside it.
In every file I have on the site, I have to call the function file. I do it this way:
include "Funcoes/Inverte_Data.php";
What I wanted to know is, if I put all my functions inside a single file and call it in Logado.php
, would slow down the system?
Because I think it would be much more practical, because since all the functions are in the main file, I’ll just be able to run, like:
inverteData($data);
What they recommend me to do?
I believe it’s slower to call multiple separate files than just a single one. If it is customary to call more than one file, I believe it is better to unite all functions in one.
– Inkeliz
How about you measure? If you can’t tell the difference it probably doesn’t matter.
– Maniero
I already thought about it some time ago as follows: "If so, wouldn’t it be better to comment elsewhere, since comment lines will also increase the physical size of the file and increase the weight of the file processing in the application?". Soon I think it’s better to have a well-organized archive inside.
– William Novak
I understand, but whenever I recharge the system,
Logado.php
it will load all functions, even those that will not be used. This will not slow down the system?– Hugo Borges
Loaded for you means she’ll be executed, even if she’s not called ? Why "loaded" I understand how it was imported into the code to be used when requested. Before that, she sits there very quietly and does not bother anyone.
– William Novak