WHAT’S THE DIFFERENCE BETWEEN INCLUDE AND REQUIRE?

Sanjay Sharma

Total Post:42

Points:210
Posted by  Sanjay Sharma
PHP 
PHP
 1226  View(s)
Ratings:
Rate this:
  1. Sanjay Sharma

    Post:42

    Points:210
    What’s the difference between include and require?

    Difference between include and require

    It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.The key difference between require() and include() is that if you require() a file that can't be loaded (eg if it isn't there) then it generates a fatal error which will halt the execution of the page completely, and no more output will be generated. On the other hand, if you include() a file that can't be loaded, then this will merely generate a warning and continue building the page.

      Modified On Apr-04-2016 01:09:07 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!