| [main] [misc] [graphics] [page design] [site design] [xhtml] [css] [xml] [xsl] [schema] [javascript] [php] [mysql] | |
Note that all external links will open up in a separate window. This is a stripped down version of these pages for older browsers. These pages are really meant to be viewed in a standards compliant browser. |
Including PHPThese tutorials are about PHP and its use for server-side Web programming. Including PHPAs well as embedding PHP in documents, you can copy in code, PHP and otherwise, from other document sources. PHP has two commands that allow you to do this:
Both do the same thing. The difference between them is that The both have the same syntax: <?php include somefile; ?> <?php require somefile; ?>
The document being referenced is copied in at that location in the code of the main document. In essence, it replaces the The document being included is also treated as a discrete document. Any PHP in the document must be inside its own PHP tags, even if the entire included document is PHP. This makes sense if you think about it. It says, we don't know the nature of what we are including, so don't process its contents as PHP unless the contents specify to do so.
The document being referenced must be a local file, residing on the same server as the document attempting to include it. If you want to include remote files, then you must enable the
There is not requirement as to what you name your local file names that are referenced with your
Newer code editors that are PHP aware will treat the
If you include an external file multiple times in the same document, it will be copied into each location. If the external file contains functions that are defined within that file, this can cause an error as that it results in the multiple definition of the same function. PHP provides a way around this with the Scope of included content matches that of the location in which is was included.
These pages can be found at:
[http://academ.hvcc.edu/~kantopet/]
|