Is there a possibility of including all functions within directory within a class. For example:
class.php
class all_functions{
foreach(glob(__DIR__.'/functions/*.php') as $file){include($file);}
}
functions/function1.php
function hello(){
echo 'hello';
}
functions/function2.php
function goodbye(){
echo 'goodbye';
}
Result would be a class all_functions()
that includes functions hello()
and goodbye()
. I'd like to just add functions into a class by just adding a file with the function.