{"id":886,"date":"2018-01-28T22:10:07","date_gmt":"2018-01-28T15:10:07","guid":{"rendered":"http:\/\/www.yellowweb.id\/blog\/?p=886"},"modified":"2018-01-28T22:10:07","modified_gmt":"2018-01-28T15:10:07","slug":"include-require-php","status":"publish","type":"post","link":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/","title":{"rendered":"Include Require PHP"},"content":{"rendered":"<p>Perbedaan penggunaan fungsi PHP <code>include()<\/code> dan <code>require()<\/code>, itu ada dimana ya? Mungkin teman-teman yang baru mengenal PHP masih bertanya-tanya dimana letak perbedaan kedua fungsi PHP tersebut, karena memiliki fungsi yang sama. Lantas bagaimana dengan tambahan _once, seperti <code>include_once()<\/code> atau <code>require_once()<\/code>. Baik kita akan cari tahu sekarang.<br \/>\n<!--more--><\/p>\n<p>Fungsi <code>include()<\/code> dan <code>require()<\/code> PHP memiliki kemampuan untuk menyertakan atau menyisipkan file yang berbeda ke dalam file PHP yang lain. Maksudnya file yang berada di tempat yang berbeda atau terpisah, misalnya di lokasi (direktori\/folder) yang berbeda dapat ikut disertakan kedalamn proses yang nanti akan dijalankan. Teknik penyisipan file ini akan sangat membantu ketika menulis baris pemrograman, karena kita tidak akan menulis baris program yang sama secara berulang-ulang.<\/p>\n<p>Teknik penulisannya sebagai berikut:<\/p>\n<p>Katakanlah kita memiliki file<code> index.php<\/code> yang didalamnya akan kita sisipkan file <code>halo.php<\/code><\/p>\n<pre class=\"lang:default decode:true \">&lt;?php include ('halo.php');?&gt;<\/pre>\n<p>contoh diatas menggunakan teknik <code>inlcude()<\/code>, tidak jauh berbeda dengan fungsi <code>require()<\/code>, berikut contoh penggunaan <code>require()<\/code><\/p>\n<pre class=\"lang:default decode:true \">&lt;?php require ('halo.php');?&gt;<\/pre>\n<p>bagaimana dengan kalau file tersebut berada diluar folder, caranya dengan menambahkan titik dua kali <code>\"..\/namafile\"<\/code><\/p>\n<pre class=\"lang:default decode:true \">&lt;?php include ('..\/halo.php');?&gt;\r\n&lt;?php require ('..\/halo.php');?&gt;<\/pre>\n<p>dan jika file yang akan kita sisipkan berada didalam folder penulisannya seperti berikut <code>\"namafolder\/namafile.php\";<\/code><\/p>\n<pre class=\"lang:default decode:true \">include ('assets\/halo.php');<\/pre>\n<p>Sekarang teman-teman buatlah file <code>index.php<\/code> kemudian <code>halo.php<\/code><\/p>\n<p>file index.php<\/p>\n<pre class=\"lang:default decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Include &amp; Require&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n\t&lt;?php \r\n\t\t\/\/ menggunakan include\r\n\t\tinclude ('halo.php');\r\n\t?&gt;\r\n\t\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>file halo.php<\/p>\n<pre class=\"lang:default decode:true \">&lt;h1&gt;Halo, tulisan ini  ada di file halo.php&lt;\/h1&gt;<\/pre>\n<p>hasilnya sebagai berikut:<\/p>\n<div id=\"attachment_891\" style=\"width: 525px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-891\" class=\"wp-image-891 size-full\" src=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include.jpg\" alt=\"include.jpg\" width=\"515\" height=\"293\" srcset=\"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include.jpg 515w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-300x171.jpg 300w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><p id=\"caption-attachment-891\" class=\"wp-caption-text\">include php<\/p><\/div>\n<p>Dapat diperhatikan pada contoh diatas, disaat file <code>index.php<\/code> dijalankan secara otomatis file <code>halo.php<\/code> ikut ditampilkan. Karena kita menggunakan fungsi <code>include()<\/code>, lantas bagaimana jika kita menggunakan fungsi<code> require()<\/code>. Hasilnya akan sama saja, <strong><em>namun perbedaan yang paling terlihat adalah ketika file yang kita sisipkan itu tidak ada atau katakanlah pada saat kita sisipkan salah pemanggilan\/ penulisan <code>nama file<\/code> misalnya filenya tertulis <code>haloxx.php<\/code>.<\/em><\/strong><\/p>\n<p>kita modifikasi file index, coba teman-teman ganti baris kode berikut:<\/p>\n<pre class=\"lang:default decode:true \">include ('halo.php');<\/pre>\n<p>menjadi<\/p>\n<pre class=\"lang:default decode:true \">include ('haloxx.php');<\/pre>\n<p>baris kode detailnya sebagai berikut:<\/p>\n<pre class=\"lang:default decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Include &amp; Require&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n\t&lt;?php \r\n\t\t\/\/ menggunakan include\r\n\t\tinclude ('assets\/halo.php');\r\n\t\techo \"Tulisan ini berada dibawah fungsi include PHP\";\r\n\t?&gt;\r\n\r\n\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>Error pada fungsi include(), akan terlihat pada gambar berikut:<\/p>\n<div id=\"attachment_893\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-error.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-893\" class=\"wp-image-893 size-medium\" src=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-error-300x65.jpg\" alt=\"include-error.jpg\" width=\"300\" height=\"65\" srcset=\"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-error-300x65.jpg 300w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-error-768x167.jpg 768w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-error-1024x222.jpg 1024w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-error.jpg 1042w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-893\" class=\"wp-caption-text\">include-error<\/p><\/div>\n<p>kemudian modifikasi kembali file <code>index.php<\/code> seperti berikut, kemudian jalankan:<\/p>\n<pre class=\"lang:default decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Include &amp; Require&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n\t&lt;?php \r\n\t\t\/\/ menggunakan require\r\n\t\trequire ('haloxx.php');\r\n\t\techo \"Tulisan ini berada dibawah fungsi require PHP\";\r\n\t?&gt;\r\n\r\n\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>error yang akan ditampilkan akan terlihat pada gambar berikut:<\/p>\n<div id=\"attachment_894\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/required-error.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-894\" class=\"wp-image-894 size-medium\" src=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/required-error-300x58.jpg\" alt=\"required-error.jpg\" width=\"300\" height=\"58\" srcset=\"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/required-error-300x58.jpg 300w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/required-error-768x148.jpg 768w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/required-error-1024x197.jpg 1024w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/required-error.jpg 1038w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-894\" class=\"wp-caption-text\">required-error<\/p><\/div>\n<p>Bila kita amati jika kita menggunakan fungsi include pada saat ingin menyisipkan sebuah file, namun saat penulisan kita mengalami kesalah, maka file yang kita jalankan tetap akan menampilkan bagian atau baris kode selanjutnya, sedangkan jika kita menggunakan fungsi require, maka pada saat mengalami error baris kode berikutnya tidak akan ditampilkan atau berhenti.<\/p>\n<p>Oke sampai disini cukup dapat dimengerti ya, ternyata aksi dari fungsi tersebut apakah program akan terus dijalankan atau tidak.<\/p>\n<p>Kita lanjutkan dengan include_once, require_once<\/p>\n<p>Contoh kasus seperti ini, bagaimana jika kita menuliskan baris include()lebih dari satu kali, lihat baris kode berikut:<\/p>\n<pre class=\"lang:default decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Include &amp; Require&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n\t&lt;?php \r\n\t\t\/\/ menggunakan include\r\n\t\tinclude ('halo.php');\r\n\t\tinclude ('halo.php');\r\n\t?&gt;\r\n\r\n\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>hasilnya akan terlihat pada gambar berikut ini:<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_895\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include_once.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-895\" class=\"size-medium wp-image-895\" src=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include_once-300x169.jpg\" alt=\"include_once.jpg\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include_once-300x169.jpg 300w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include_once.jpg 537w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-895\" class=\"wp-caption-text\">include_once.<\/p><\/div>\n<p>terlihat akan tercetak dua baris dengan tampilan yang sama, sekarang kita akan menambahkan<code> _once()<\/code>, oke seperti ini <code>include_once()<\/code>;<\/p>\n<pre class=\"lang:default decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Include &amp; Require&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n\t&lt;?php \r\n\t\t\/\/ menggunakan include\r\n\t\tinclude_once ('halo.php');\r\n\t\tinclude_once ('halo.php');\r\n\t\t\r\n\t?&gt;\r\n\r\n\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>sebanyak apa pun kita menyisipkan pada baris kode yang kita buat dengan menggunakan include_once() atau require_once(), tetap akan tercetak di browser sebanyak satu kali. Lihat gambar berikut:<\/p>\n<div id=\"attachment_891\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-891\" class=\"wp-image-891 size-medium\" src=\"http:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-300x171.jpg\" alt=\"include.jpg\" width=\"300\" height=\"171\" srcset=\"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-300x171.jpg 300w, https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include.jpg 515w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-891\" class=\"wp-caption-text\">include php<\/p><\/div>\n<p>Kapan teman-teman menggunakan fungsi <code>include()<\/code> atau <code>require()<\/code>,<br \/>\nUmumnya <code>include() <\/code>digunakan disaat kita ingin menyisipkan file-file umum seperti saat membuat template contoh: <code>include \"header.php\", include \"sidebar.php\"<\/code> sedangkan <code>require()<\/code> umumnya agak spesifik seperti file fungsi atau class.<\/p>\n<p>Sumbernya bisa kalian lihat disini<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/21814296\/what-is-difference-between-include-once-and-require-once-in-php\" target=\"_blank\" rel=\"noopener\">https:\/\/stackoverflow.com\/questions\/21814296\/what-is-difference-between-include-once-and-require-once-in-php<\/a><br \/>\n<a href=\"https:\/\/www.w3schools.com\/php\/php_includes.asp\" target=\"_blank\" rel=\"noopener\">https:\/\/www.w3schools.com\/php\/php_includes.asp<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perbedaan penggunaan fungsi PHP include() dan require(), itu ada dimana ya? Mungkin teman-teman yang baru mengenal PHP masih bertanya-tanya dimana letak perbedaan kedua fungsi PHP tersebut, karena memiliki fungsi yang sama. Lantas bagaimana dengan tambahan _once, seperti include_once() atau require_once(). Baik kita akan cari tahu sekarang.<\/p>\n","protected":false},"author":1,"featured_media":897,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[403,405,407,404,406],"class_list":["post-886","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-include","tag-include_once","tag-phh","tag-require","tag-require_once"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Include Require PHP - YELLOWWEB.ID<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.yellowweb.id\/blog\/include-require-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Include Require PHP - YELLOWWEB.ID\" \/>\n<meta property=\"og:description\" content=\"Perbedaan penggunaan fungsi PHP include() dan require(), itu ada dimana ya? Mungkin teman-teman yang baru mengenal PHP masih bertanya-tanya dimana letak perbedaan kedua fungsi PHP tersebut, karena memiliki fungsi yang sama. Lantas bagaimana dengan tambahan _once, seperti include_once() atau require_once(). Baik kita akan cari tahu sekarang.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.yellowweb.id\/blog\/include-require-php\/\" \/>\n<meta property=\"og:site_name\" content=\"YELLOWWEB.ID\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-28T15:10:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-01.jpg?fit=600%2C290&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"290\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"yellowweb\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"yellowweb\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/\"},\"author\":{\"name\":\"yellowweb\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#\\\/schema\\\/person\\\/75188044e080844724e381ab6a5b9829\"},\"headline\":\"Include Require PHP\",\"datePublished\":\"2018-01-28T15:10:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/\"},\"wordCount\":511,\"image\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/include-01.jpg\",\"keywords\":[\"include\",\"include_once\",\"phh\",\"require\",\"require_once\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/\",\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/\",\"name\":\"Include Require PHP - YELLOWWEB.ID\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/include-01.jpg\",\"datePublished\":\"2018-01-28T15:10:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#\\\/schema\\\/person\\\/75188044e080844724e381ab6a5b9829\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/include-01.jpg\",\"contentUrl\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/include-01.jpg\",\"width\":600,\"height\":290,\"caption\":\"include-01\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/include-require-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Include Require PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/\",\"name\":\"YELLOWWEB.ID\",\"description\":\"Kursus Web Design | Kursus Web Programming | Mobile Web Apps | Digital Marketing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#\\\/schema\\\/person\\\/75188044e080844724e381ab6a5b9829\",\"name\":\"yellowweb\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g\",\"caption\":\"yellowweb\"},\"sameAs\":[\"https:\\\/\\\/www.yellowweb.id\"],\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/author\\\/yellowweb\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Include Require PHP - YELLOWWEB.ID","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/","og_locale":"en_GB","og_type":"article","og_title":"Include Require PHP - YELLOWWEB.ID","og_description":"Perbedaan penggunaan fungsi PHP include() dan require(), itu ada dimana ya? Mungkin teman-teman yang baru mengenal PHP masih bertanya-tanya dimana letak perbedaan kedua fungsi PHP tersebut, karena memiliki fungsi yang sama. Lantas bagaimana dengan tambahan _once, seperti include_once() atau require_once(). Baik kita akan cari tahu sekarang.","og_url":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/","og_site_name":"YELLOWWEB.ID","article_published_time":"2018-01-28T15:10:07+00:00","og_image":[{"width":600,"height":290,"url":"https:\/\/i0.wp.com\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-01.jpg?fit=600%2C290&ssl=1","type":"image\/jpeg"}],"author":"yellowweb","twitter_card":"summary_large_image","twitter_misc":{"Written by":"yellowweb","Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#article","isPartOf":{"@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/"},"author":{"name":"yellowweb","@id":"https:\/\/www.yellowweb.id\/blog\/#\/schema\/person\/75188044e080844724e381ab6a5b9829"},"headline":"Include Require PHP","datePublished":"2018-01-28T15:10:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/"},"wordCount":511,"image":{"@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-01.jpg","keywords":["include","include_once","phh","require","require_once"],"articleSection":["PHP"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/","url":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/","name":"Include Require PHP - YELLOWWEB.ID","isPartOf":{"@id":"https:\/\/www.yellowweb.id\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#primaryimage"},"image":{"@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-01.jpg","datePublished":"2018-01-28T15:10:07+00:00","author":{"@id":"https:\/\/www.yellowweb.id\/blog\/#\/schema\/person\/75188044e080844724e381ab6a5b9829"},"breadcrumb":{"@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.yellowweb.id\/blog\/include-require-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#primaryimage","url":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-01.jpg","contentUrl":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2018\/01\/include-01.jpg","width":600,"height":290,"caption":"include-01"},{"@type":"BreadcrumbList","@id":"https:\/\/www.yellowweb.id\/blog\/include-require-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.yellowweb.id\/blog\/"},{"@type":"ListItem","position":2,"name":"Include Require PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.yellowweb.id\/blog\/#website","url":"https:\/\/www.yellowweb.id\/blog\/","name":"YELLOWWEB.ID","description":"Kursus Web Design | Kursus Web Programming | Mobile Web Apps | Digital Marketing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.yellowweb.id\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.yellowweb.id\/blog\/#\/schema\/person\/75188044e080844724e381ab6a5b9829","name":"yellowweb","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g","caption":"yellowweb"},"sameAs":["https:\/\/www.yellowweb.id"],"url":"https:\/\/www.yellowweb.id\/blog\/author\/yellowweb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts\/886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/comments?post=886"}],"version-history":[{"count":7,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts\/886\/revisions"}],"predecessor-version":[{"id":898,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts\/886\/revisions\/898"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/media\/897"}],"wp:attachment":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/media?parent=886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/categories?post=886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/tags?post=886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}