terryds Posted June 3, 2013 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 ? Link to comment Share on other sites More sharing options...
birbal Posted June 3, 2013 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now