Include does not behave like copy paste.
Here is a demonstration using PHP Strict Type Declarations
<?php
// function.php (file)
declare (strict_types = 1);
function sum(int $a, int $b)
{
return $a + $b;
}
/**
* This will throw TypeError:
*/
// echo sum(5.2, 5);
However, if I call this function from an external file
<?php
// caller.php (file)
require_once 'function.php';
/**
* This will Work instead of throwing a TypeError:
*/
echo sum(5.2, 5);
Strict types are enabled for the file that the declare statement was added (function.php)
It does not apply for any function calls made from an external file (caller.php)
because PHP will always defer to the caller when looking to evaluate strict types.
Require doesn't work like copy/paste
For further understanding,
Short answer on how PHP script is Executed &
A more comprehensible explanation on what include/require really does in php