What is the difference between using include and function in PHP?

The main difference between using include and function in PHP is that include is used to include and execute a specific file in the current script, while a function is a block of code that can be reused multiple times within the script. Include is typically used for including external files such as libraries or templates, while functions are used to encapsulate a specific set of instructions for reuse.

// Using include to include an external file
include 'external_file.php';

// Using a function to encapsulate a set of instructions for reuse
function myFunction() {
    // Code block to be executed
}