I'd like to check if my understanding's correct about require_once()
. I have a bunch of functions in file foo.php
. Let's say 7/8 out of them are always used, and one of them's rather rare and rather large. I have to keep this function's definition in foo.php
. Can you tell me if the following approach achieves anything, and if you think it's worth what it achieves.
- Take out the body of the function and put it in an external file.
- Redefine the original function to
require_once()
that particular file and pass execution over to the helper function.
I understand this could save server memory on the requests where that function isn't run. What exactly am I saving though? Just the memory it takes to hold the body of the function? That would mean it would have to be a pretty big function before being worth it I guess. Also, if I'm using something like APC does it become less useful?
Please correct or add to this as appropriate!
Thank you very much.