top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the differences between require and include, include_once and require_once?

+2 votes
449 views
What are the differences between require and include, include_once and require_once?
posted Apr 2, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

require will throw a PHP Fatal Error if the file cannot be loaded. (Execution stops)
VS
include produces a Warning if the file cannot be loaded. (Execution continues)

The require_once() statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.
VS
The include_once() statement is identical to include() except PHP will check if the file has already been included, and if so, not include (require) it again.

answer Apr 2, 2015 by Kali Mishra
Similar Questions
0 votes

I use the pretty large Library PHP Image Workshop (http://phpimageworkshop.com/) at my project. It is about 75,5 KB. Everything works fine but if I try to include a 15 KB file with country codes, it fails. With the other files I easily get over 100 KB inclusion size, so my question; Is there a size limitation for include?

...