{"id":89,"date":"2021-03-08T00:16:42","date_gmt":"2021-03-08T00:16:42","guid":{"rendered":"https:\/\/phptutorial.net\/?page_id=89"},"modified":"2025-04-06T07:48:46","modified_gmt":"2025-04-06T07:48:46","slug":"php-include-file","status":"publish","type":"page","link":"https:\/\/www.phptutorial.net\/php-tutorial\/php-include-file\/","title":{"rendered":"PHP Include"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to include code from a file using the PHP <code>include<\/code> construct.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-php-include-construct'>Introduction to PHP include construct <a href=\"#introduction-to-php-include-construct\" class=\"anchor\" id=\"introduction-to-php-include-construct\" title=\"Anchor for Introduction to PHP include construct\">#<\/a><\/h2>\n\n\n\n<p>The <code>include<\/code> construct allows you to load the code from another file into a file. Here&#8217;s the syntax of the <code>include<\/code> construct:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'path_to_file'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax, you place the path to the file after the <code>include<\/code> keyword. For example, to load the code from the <code>functions.php<\/code> file into the <code>index.php<\/code> file, you can use the following <code>include<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-meta\">&lt;?php<\/span> \n\n<span class=\"hljs-comment\">\/\/ index.php file<\/span>\n<span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'functions.php'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If PHP cannot find the <code>'functions.php'<\/code> file in the <code>src<\/code> directory, it&#8217;ll issue a warning. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Warning: <span class=\"hljs-keyword\">include<\/span>(functions.php): failed to open stream: No such file <span class=\"hljs-keyword\">or<\/span> directory in ... on line <span class=\"hljs-number\">4<\/span>\nWarning: <span class=\"hljs-keyword\">include<\/span>(): Failed opening <span class=\"hljs-string\">'functions.php'<\/span> <span class=\"hljs-keyword\">for<\/span> inclusion (include_path=<span class=\"hljs-string\">'\\xampp\\php\\PEAR'<\/span>) in ... on line <span class=\"hljs-number\">4<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When loading the <code>functions.php<\/code> file, PHP first looks for the <code>functions.php<\/code> file in the directory specified by the <code>include_path<\/code>. In this example, it&#8217;s <code>'\\xampp\\php\\PEAR'<\/code>. If PHP can find the <code>functions.php<\/code> file there, it loads the code from the file.<\/p>\n\n\n\n<p>Otherwise, PHP searches the <code>functions.php<\/code> file in the directory of the calling script and the current working directory. If PHP can find the <code>functions.php<\/code> file there, it loads the code. Otherwise, it issues a warning if the file doesn&#8217;t exist.<\/p>\n\n\n\n<p>When PHP loads the <code>functions.php<\/code> file, it executes the code inside the <code>functions.php<\/code> file. For example, if you place the following code in the <code>functions.php<\/code> file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n<span class=\"hljs-comment\">\/\/ functions.php<\/span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">get_copyright<\/span><span class=\"hljs-params\">()<\/span>\n<\/span>{\n\t<span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-string\">'Copyright &amp;copy; '<\/span> . date(<span class=\"hljs-string\">'Y'<\/span>) . <span class=\"hljs-string\">' by phptutorial.net. All Rights Reserved!'<\/span>;\n}\n\n<span class=\"hljs-keyword\">echo<\/span> get_copyright();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>and include the <code>functions.php<\/code> in the <code>index.php<\/code> file, you&#8217;ll see the following output when you run the <code>index.php<\/code> file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Copyright \u00a9 <span class=\"hljs-number\">2021<\/span> by phptutorial.net. All Rights Reserved!<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This demonstrated that the <code>include<\/code> construct does make PHP execute code in the <code>functions.php<\/code> file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='php-include-example'>PHP include example <a href=\"#php-include-example\" class=\"anchor\" id=\"php-include-example\" title=\"Anchor for PHP include example\">#<\/a><\/h2>\n\n\n\n<p>In practice, you&#8217;ll often use the <code>include<\/code> construct to the page elements from a general site design. For example, all pages on your website may have the same header and footer.<\/p>\n\n\n\n<p>To avoid repeating these elements on multiple pages, you can place the code of the header and footer in separate files such as <code>header.php<\/code> and <code>footer.php<\/code> and include them on the pages.<\/p>\n\n\n\n<p>Typically, you place the template files\u00a0 <code>header.php<\/code> and <code>footer.php<\/code> in a separate directory. By convention, the name of the <code>include<\/code> directory is <code>inc<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">.\n\u251c\u2500\u2500 index.php\n\u251c\u2500\u2500 functions.php\n\u251c\u2500\u2500 inc\n\u2502   \u251c\u2500\u2500 footer.php\n\u2502   \u2514\u2500\u2500 header.php\n\u2514\u2500\u2500 <span class=\"hljs-keyword\">public<\/span>\n    \u251c\u2500\u2500 css\n    \u2502   \u2514\u2500\u2500 style.css\n    \u2514\u2500\u2500 js\n        \u2514\u2500\u2500 app.js<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>header.php<\/code> file contains the code of the header of the page. It has a link to the <code>style.css<\/code> file located in the <code>public\/css<\/code> directory:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">&lt;!DOCTYPE html&gt;\n&lt;html lang=<span class=\"hljs-string\">\"en\"<\/span>&gt;\n\t&lt;head&gt;\n\t\t&lt;meta charset=<span class=\"hljs-string\">\"UTF-8\"<\/span> \/&gt;\n\t\t&lt;meta name=<span class=\"hljs-string\">\"viewport\"<\/span> content=<span class=\"hljs-string\">\"width=device-width, initial-scale=1.0\"<\/span> \/&gt;\n\t\t&lt;link rel=<span class=\"hljs-string\">\"stylesheet\"<\/span> href=<span class=\"hljs-string\">\"public\/css\/style.css\"<\/span>&gt;\n\t\t&lt;title&gt;PHP <span class=\"hljs-keyword\">include<\/span> Example&lt;\/title&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>footer.php<\/code> file contains the code related to the footer of the page:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">&lt;script src=<span class=\"hljs-string\">\"js\/app.js\"<\/span>&gt;&lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the <code>index.php<\/code> file, you can include the <code>header.php<\/code> and <code>footer.php<\/code> file like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'inc\/header.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span>\n\n&lt;h1&gt;PHP <span class=\"hljs-keyword\">include<\/span>&lt;\/h1&gt;\n&lt;p&gt;This shows how the PHP <span class=\"hljs-keyword\">include<\/span> construct works.&lt;\/p&gt;\n\n<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'inc\/footer.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you run the <code>index.php<\/code> file and view the source code of the page, you&#8217;ll also see the code from the <code>header.php<\/code> and <code>footer.php<\/code> files:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">&lt;!DOCTYPE html&gt;\n&lt;html lang=<span class=\"hljs-string\">\"en\"<\/span>&gt;\n\t&lt;head&gt;\n\t\t&lt;meta charset=<span class=\"hljs-string\">\"UTF-8\"<\/span> \/&gt;\n\t\t&lt;meta name=<span class=\"hljs-string\">\"viewport\"<\/span> content=<span class=\"hljs-string\">\"width=device-width, initial-scale=1.0\"<\/span> \/&gt;\n\t\t&lt;link rel=<span class=\"hljs-string\">\"stylesheet\"<\/span> href=<span class=\"hljs-string\">\"public\/css\/style.css\"<\/span> \/&gt;\n\t\t&lt;title&gt;PHP <span class=\"hljs-keyword\">include<\/span> Example&lt;\/title&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;\n\t\t&lt;h1&gt;PHP <span class=\"hljs-keyword\">include<\/span>&lt;\/h1&gt;\n\t\t&lt;p&gt;This shows how the PHP <span class=\"hljs-keyword\">include<\/span> construct works.&lt;\/p&gt;\n\n\t\t&lt;script src=<span class=\"hljs-string\">\"public\/js\/app.js\"<\/span>&gt;&lt;\/script&gt;\n\t&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='php-include-variable-scopes'>PHP include &amp; variable scopes <a href=\"#php-include-variable-scopes\" class=\"anchor\" id=\"php-include-variable-scopes\" title=\"Anchor for PHP include &amp; variable scopes\">#<\/a><\/h2>\n\n\n\n<p>When you include a file, all the variables defined in that file inherit the <a href=\"https:\/\/phptutorial.net\/php-tutorial\/php-variable-scopes\/\">variable scope<\/a> of the line on which the include occurs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='including-outside-a-function-example'>Including outside a function example <a href=\"#including-outside-a-function-example\" class=\"anchor\" id=\"including-outside-a-function-example\" title=\"Anchor for Including outside a function example\">#<\/a><\/h3>\n\n\n\n<p>For example, the following defines the <code>$title<\/code> and <code>$content<\/code> variables in the <code>functions.php<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n<span class=\"hljs-comment\">\/\/ functions.php<\/span>\n\n$title = <span class=\"hljs-string\">'PHP include'<\/span>;\n$content = <span class=\"hljs-string\">'This shows how the PHP include construct works.'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When you include the <code>functions.php<\/code> in the <code>index.php<\/code> file, the <code>$title<\/code> and <code>$content<\/code> variables become the global variables in the <code>index.php<\/code> file. And you can use them as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'inc\/header.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span>\n\n\n<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include_once<\/span> <span class=\"hljs-string\">'functions.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span>\n\n&lt;h1&gt;<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">echo<\/span> $title; <span class=\"hljs-meta\">?&gt;<\/span>&lt;\/h1&gt;\n&lt;p&gt;<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">echo<\/span> $content; <span class=\"hljs-meta\">?&gt;<\/span>&lt;\/p&gt;\n\n\n<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'inc\/footer.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='including-within-a-function-example'>Including within a function example <a href=\"#including-within-a-function-example\" class=\"anchor\" id=\"including-within-a-function-example\" title=\"Anchor for Including within a function example\">#<\/a><\/h3>\n\n\n\n<p>However, if you include a file in a <a href=\"https:\/\/phptutorial.net\/php-tutorial\/php-functions\/\">function<\/a>, the variables from the included file are local to that function. See the following example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'inc\/header.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span>\n<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include_once<\/span> <span class=\"hljs-string\">'functions.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span>\n\n<span class=\"hljs-meta\">&lt;?php<\/span>\n\t<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">render_article<\/span><span class=\"hljs-params\">()<\/span>\n\t<\/span>{\n\t\t<span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'functions.php'<\/span>;\n\n\t\t<span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-string\">\"&lt;article&gt;\n                    &lt;h1&gt;$title&lt;\/h1&gt;\n                $content\n                &lt;\/article&gt;\"<\/span>;\n\t}\n\n\t<span class=\"hljs-keyword\">echo<\/span> render_article();\n<span class=\"hljs-meta\">?&gt;<\/span>\n\n\n<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">include<\/span> <span class=\"hljs-string\">'inc\/footer.php'<\/span>; <span class=\"hljs-meta\">?&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we include the <code>functions.php<\/code> inside the <code>render_article()<\/code> function. Therefore, the <code>$title<\/code> and <code>$content<\/code> variables from the <code>functions.php<\/code> are local to the <code>render_function()<\/code>.<\/p>\n\n\n\n<p>It&#8217;s important to note that all <a href=\"https:\/\/phptutorial.net\/php-tutorial\/php-functions\/\">functions<\/a>, <a href=\"https:\/\/phptutorial.net\/php-oop\/php-objects\/\">classes<\/a>, <a href=\"https:\/\/phptutorial.net\/php-tutorial\/php-interface\/\">interfaces<\/a>, and <a href=\"https:\/\/phptutorial.net\/php-oop\/php-traits\/\">traits<\/a> defined in the included file will have a global scope.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the PHP <code>include<\/code> construct to load code from another script file.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Did you find this tutorial useful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"89\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-tutorial\/php-include-file\/\"\n\t\t\t\tdata-post-title=\"PHP Include\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"89\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-tutorial\/php-include-file\/\"\n\t\t\t\tdata-post-title=\"PHP Include\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary: in this tutorial, you will learn how to include code from a file using the PHP include construct. Introduction to PHP include construct # The include construct allows you to load the code from another file into a file. Here&#8217;s the syntax of the include construct: In this syntax, you place the path to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":15,"menu_order":73,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-89","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":5,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/89\/revisions"}],"predecessor-version":[{"id":3134,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/89\/revisions\/3134"}],"up":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/15"}],"wp:attachment":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/media?parent=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}