H2S116: Require-construction lit-rev:

Hu: PHP reports that # the code from a required | doc will be inserted into a requiring | doc, and run, as if it were written, on and from # the line in which the function require is written<Turing>. This is analogous to the ROW.INSERT-func in Excel: if 100 lines of code, in a required, were added to line 56, or itself a 100 line doc, that 100 line doc, would become 200 lines, and line 57 bumped to line ~157 #

Listicle: rules of requirement:

CM H4S1: Pars-exec starts from the top of the required:

<php.net>When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file<WP.MIC-H2S47>, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags.

CM H4S2: Func-encaps are not run, by default:

Hu: As in a base-script, code encapped by funcs are not run, until they are called.

CM H4S3: Variable declarations will replace values in base, and vice versa:

Hu: Global variables of the include become global in the base, if the include is not local to a func<Turing><80%, logically-only 11/12/22>, which means that any value declaration will replace a former instance in the base, and vice versa, by a base declaration, at a higher # line from the inc #

CM H4S4: Func-encapped requires are run, when the func is run:

Moreover<php.net>, global variables in the required become local, in the base #

CM H4S5: HTTP-Incs run on a remote.server-instance:

<php.net>: If “URL include wrappers” are enabled in PHP, you can specify the file to be included using a URL (via HTTP or other supported wrapper – see Supported Protocols and Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file’s variable scope; the script is actually being run on the remote server and the result is then being included into the local script. Hu: In this case, require to an HTTP url, even if on the local-WAMP<WP.MIC-H2S34>will send an HTTP-req, to the included #

CM H4S6: Requires in the required are inserted.in-line with the required code, directly:

H5S1: Logic.chain-lit,rev: // add-MIC:

CM H4S7: Using output buffering to include a PHP file into a string:


<?php $string = get_include_contents('somefile.php');

function get_include_contents($filename) {
    if (is_file($filename)) {
        include $filename;
        return ob_get_clean();
    return false;

H4S8: https://www.php.net/manual/en/features.remote-files.php

H4S9: https://www.php.net/manual/en/function.fopen.php

H3S1: A require is an HTTP-req:

<WP.MIC-H2S88>From the error | case in<WP.MIC-H2S72,H3S5.H4S1>, we actually were able to deduce that PHP-reqs are HTTPreqs; the calling file makes an HTTPreq to the called | file in order to run that entire script, because that is one of the components of the action of an HTTP-req.



See also requirerequire_onceinclude_onceget_included_files()readfile()virtual(), and include_path. See also Remote filesfopen() and file() for related information.

Leave a Reply

Your email address will not be published. Required fields are marked *