---
title: "What’s the difference between include and require?"  
description: "What’s the difference between include and require?"  
author: "Anonymous User"  
published: 2011-03-18  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/467/what-s-the-difference-between-include-and-require  
category: "php"  
tags: ["php"]  
reading_time: 2 minutes  

---

# 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.\

## Answers

### Answer by Anonymous User

**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.\


---

Original Source: https://www.mindstick.com/interview/467/what-s-the-difference-between-include-and-require

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
