terryds 5 Posted June 3, 2013 Report Share Posted June 3, 2013 I'm confused about require and require_once... Could you please tell me the practical example of require_once and require ? Quote Link to post Share on other sites
birbal 168 Posted June 3, 2013 Report Share Posted June 3, 2013 Both do same it pulls the file (something like interpreter handled copy paste) and if file extension supports to parse or execute it will parse it eg when you use require_*() to php file. The only difference between both is. require_once() maintain a hash table which consists of list of file it is already included. Where as require() does not have that and try to include same file as many times it encounters. As require_once() check its hash table before any inclusion of files it is little slower (academically) than require(). though it is negligible.Usually you would use require_once() where you must have to include a file for one time, like class,function declaration Where as you can use require() in repetitive scenario. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.