This is a matter of general design, not personal preference. If you can design with personal preferences, then these are your personal preferences. Do anything, use the language as a tool .
For example, if you use PHP as a replacement for the server side, it is quite common, including mostly HTML with some PHP fragments included. Great facilities were built with this. There is nothing wrong with this design in the real world.
However, if you need finer-scale management, you mostly refer to objects instead of files. In this case, I suggest that you do not include any inclusions in your code, but an autoloader, which, if necessary, requires, upon request, the class name in your application.
However, the example that you have in your question looks like there aren’t many concepts for it anyway, maybe this should allow you to have local variables inside include, however this is easier to achieve by including dynamically inside the auxiliary helper function, eg
function include_helper() { if (!func_num_args()) { return NULL; } elseif (2 === func_num_args() && is_array(func_get_arg(1))) { extract(func_get_arg(1)); } return include(func_get_arg(0)); }
And so the functions that are spare to the definition inside each include the same name as include.
hakre source share