I have this problem that I have many huge functions, and I’m using only few in a given script.
Every function sits in its own file. It would be nice to be able to ‘autoload’ or rather require_once a file when given function doesn’t exists.
Maybe is there a way to override Fatal error: Call to undefined function... at the beginning of a script, so everytime that error fires up the script would first try to require_once a file name with name of a non existent function, and then try to call the function again.
Since php 5.3.0 you could do someting like:
And then use it like (for example):
Which would try to load a file in
funcs/helloworld.func.phpand executehelloworldafter successfull loading.This way you could ommit the repeated inline tests.