CINXE.COM

PHP: file_get_contents - Manual

<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PHP: file_get_contents - Manual </title> <link rel="icon" type="image/svg+xml" sizes="any" href="https://www.php.net/favicon.svg?v=2"> <link rel="icon" type="image/png" sizes="196x196" href="https://www.php.net/favicon-196x196.png?v=2"> <link rel="icon" type="image/png" sizes="32x32" href="https://www.php.net/favicon-32x32.png?v=2"> <link rel="icon" type="image/png" sizes="16x16" href="https://www.php.net/favicon-16x16.png?v=2"> <link rel="shortcut icon" href="https://www.php.net/favicon.ico?v=2"> <link rel="search" type="application/opensearchdescription+xml" href="http://php.net/phpnetimprovedsearch.src" title="Add PHP.net search"> <link rel="alternate" type="application/atom+xml" href="https://www.php.net/releases/feed.php" title="PHP Release feed"> <link rel="alternate" type="application/atom+xml" href="https://www.php.net/feed.atom" title="PHP: Hypertext Preprocessor"> <link rel="canonical" href="https://www.php.net/manual/en/function.file-get-contents.php"> <link rel="shorturl" href="https://www.php.net/file-get-contents"> <link rel="alternate" href="https://www.php.net/file-get-contents" hreflang="x-default"> <link rel="contents" href="https://www.php.net/manual/en/index.php"> <link rel="index" href="https://www.php.net/manual/en/ref.filesystem.php"> <link rel="prev" href="https://www.php.net/manual/en/function.file-exists.php"> <link rel="next" href="https://www.php.net/manual/en/function.file-put-contents.php"> <link rel="alternate" href="https://www.php.net/manual/en/function.file-get-contents.php" hreflang="en"> <link rel="alternate" href="https://www.php.net/manual/de/function.file-get-contents.php" hreflang="de"> <link rel="alternate" href="https://www.php.net/manual/es/function.file-get-contents.php" hreflang="es"> <link rel="alternate" href="https://www.php.net/manual/fr/function.file-get-contents.php" hreflang="fr"> <link rel="alternate" href="https://www.php.net/manual/it/function.file-get-contents.php" hreflang="it"> <link rel="alternate" href="https://www.php.net/manual/ja/function.file-get-contents.php" hreflang="ja"> <link rel="alternate" href="https://www.php.net/manual/pt_BR/function.file-get-contents.php" hreflang="pt_BR"> <link rel="alternate" href="https://www.php.net/manual/ru/function.file-get-contents.php" hreflang="ru"> <link rel="alternate" href="https://www.php.net/manual/tr/function.file-get-contents.php" hreflang="tr"> <link rel="alternate" href="https://www.php.net/manual/uk/function.file-get-contents.php" hreflang="uk"> <link rel="alternate" href="https://www.php.net/manual/zh/function.file-get-contents.php" hreflang="zh"> <link rel="stylesheet" type="text/css" href="/cached.php?t=1707321815&amp;f=/fonts/Fira/fira.css" media="screen"> <link rel="stylesheet" type="text/css" href="/cached.php?t=1707321815&amp;f=/fonts/Font-Awesome/css/fontello.css" media="screen"> <link rel="stylesheet" type="text/css" href="/cached.php?t=1738926002&amp;f=/styles/theme-base.css" media="screen"> <link rel="stylesheet" type="text/css" href="/cached.php?t=1730558402&amp;f=/styles/theme-medium.css" media="screen"> <base href="https://www.php.net/manual/en/function.file-get-contents.php"> <meta name="Description" content="PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world." /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@official_php" /> <meta name="twitter:title" content="PHP: Hypertext Preprocessor" /> <meta name="twitter:description" content="PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world." /> <meta name="twitter:creator" content="@official_php" /> <meta name="twitter:image:src" content="https://www.php.net/images/meta-image.png" /> <meta itemprop="name" content="PHP: Hypertext Preprocessor" /> <meta itemprop="description" content="PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world." /> <meta itemprop="image" content="https://www.php.net/images/meta-image.png" /> <meta property="og:image" content="https://www.php.net/images/meta-image.png" /> <meta property="og:description" content="PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world." /> <link href="https://fosstodon.org/@php" rel="me" /> <!-- Matomo --> <script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://analytics.php.net/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> </head> <body class="docs "> <nav class="navbar navbar-fixed-top"> <div class="navbar__inner"> <a href="/" aria-label="PHP Home" class="navbar__brand"> <img src="/images/logos/php-logo-white.svg" aria-hidden="true" width="80" height="40" > </a> <div id="navbar__offcanvas" tabindex="-1" class="navbar__offcanvas" aria-label="Menu" > <button id="navbar__close-button" class="navbar__icon-item navbar_icon-item--visually-aligned navbar__close-button" > <svg xmlns="http://www.w3.org/2000/svg" width="24" viewBox="0 0 24 24" fill="currentColor"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg> </button> <ul class="navbar__nav"> <li class="navbar__item"> <a href="/downloads.php" class="navbar__link " > Downloads </a> </li> <li class="navbar__item"> <a href="/docs.php" aria-current="page" class="navbar__link navbar__link--active " > Documentation </a> </li> <li class="navbar__item"> <a href="/get-involved.php" class="navbar__link " > Get Involved </a> </li> <li class="navbar__item"> <a href="/support.php" class="navbar__link " > Help </a> </li> <li class="navbar__item"> <a href="/releases/8.4/index.php" class="navbar__link navbar__release" > <img src="/images/php8/logo_php8_4.svg" alt="PHP 8.4"> </a> </li> </ul> </div> <div class="navbar__right"> <!-- Desktop default search --> <form action="/manual-lookup.php" class="navbar__search-form" > <label for="navbar__search-input" aria-label="Search docs"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" > <circle cx="11" cy="11" r="8"></circle> <line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> </label> <input type="search" name="pattern" id="navbar__search-input" class="navbar__search-input" placeholder="Search docs" accesskey="s" > <input type="hidden" name="scope" value="quickref"> </form> <!-- Desktop encanced search --> <button id="navbar__search-button" class="navbar__search-button" hidden > <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" > <circle cx="11" cy="11" r="8"></circle> <line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> Search docs </button> <!-- Mobile default items --> <a id="navbar__search-link" href="/lookup-form.php" aria-label="Search docs" class="navbar__icon-item navbar__search-link" > <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" > <circle cx="11" cy="11" r="8"></circle> <line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> </a> <a id="navbar__menu-link" href="/menu.php" aria-label="Menu" class="navbar__icon-item navbar_icon-item--visually-aligned navbar_menu-link" > <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="currentColor" > <path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /> </svg> </a> <!-- Mobile enhanced items --> <button id="navbar__search-button-mobile" aria-label="Search docs" class="navbar__icon-item navbar__search-button-mobile" hidden > <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" > <circle cx="11" cy="11" r="8"></circle> <line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> </button> <button id="navbar__menu-button" aria-label="Menu" class="navbar__icon-item navbar_icon-item--visually-aligned" hidden > <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="currentColor" > <path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /> </svg> </button> </div> <div id="navbar__backdrop" class="navbar__backdrop" ></div> </div> <div id="flash-message"></div> </nav> <nav id="trick"><div><dl> <dt><a href='/manual/en/getting-started.php'>Getting Started</a></dt> <dd><a href='/manual/en/introduction.php'>Introduction</a></dd> <dd><a href='/manual/en/tutorial.php'>A simple tutorial</a></dd> <dt><a href='/manual/en/langref.php'>Language Reference</a></dt> <dd><a href='/manual/en/language.basic-syntax.php'>Basic syntax</a></dd> <dd><a href='/manual/en/language.types.php'>Types</a></dd> <dd><a href='/manual/en/language.variables.php'>Variables</a></dd> <dd><a href='/manual/en/language.constants.php'>Constants</a></dd> <dd><a href='/manual/en/language.expressions.php'>Expressions</a></dd> <dd><a href='/manual/en/language.operators.php'>Operators</a></dd> <dd><a href='/manual/en/language.control-structures.php'>Control Structures</a></dd> <dd><a href='/manual/en/language.functions.php'>Functions</a></dd> <dd><a href='/manual/en/language.oop5.php'>Classes and Objects</a></dd> <dd><a href='/manual/en/language.namespaces.php'>Namespaces</a></dd> <dd><a href='/manual/en/language.enumerations.php'>Enumerations</a></dd> <dd><a href='/manual/en/language.errors.php'>Errors</a></dd> <dd><a href='/manual/en/language.exceptions.php'>Exceptions</a></dd> <dd><a href='/manual/en/language.fibers.php'>Fibers</a></dd> <dd><a href='/manual/en/language.generators.php'>Generators</a></dd> <dd><a href='/manual/en/language.attributes.php'>Attributes</a></dd> <dd><a href='/manual/en/language.references.php'>References Explained</a></dd> <dd><a href='/manual/en/reserved.variables.php'>Predefined Variables</a></dd> <dd><a href='/manual/en/reserved.exceptions.php'>Predefined Exceptions</a></dd> <dd><a href='/manual/en/reserved.interfaces.php'>Predefined Interfaces and Classes</a></dd> <dd><a href='/manual/en/reserved.attributes.php'>Predefined Attributes</a></dd> <dd><a href='/manual/en/context.php'>Context options and parameters</a></dd> <dd><a href='/manual/en/wrappers.php'>Supported Protocols and Wrappers</a></dd> </dl> <dl> <dt><a href='/manual/en/security.php'>Security</a></dt> <dd><a href='/manual/en/security.intro.php'>Introduction</a></dd> <dd><a href='/manual/en/security.general.php'>General considerations</a></dd> <dd><a href='/manual/en/security.cgi-bin.php'>Installed as CGI binary</a></dd> <dd><a href='/manual/en/security.apache.php'>Installed as an Apache module</a></dd> <dd><a href='/manual/en/security.sessions.php'>Session Security</a></dd> <dd><a href='/manual/en/security.filesystem.php'>Filesystem Security</a></dd> <dd><a href='/manual/en/security.database.php'>Database Security</a></dd> <dd><a href='/manual/en/security.errors.php'>Error Reporting</a></dd> <dd><a href='/manual/en/security.variables.php'>User Submitted Data</a></dd> <dd><a href='/manual/en/security.hiding.php'>Hiding PHP</a></dd> <dd><a href='/manual/en/security.current.php'>Keeping Current</a></dd> <dt><a href='/manual/en/features.php'>Features</a></dt> <dd><a href='/manual/en/features.http-auth.php'>HTTP authentication with PHP</a></dd> <dd><a href='/manual/en/features.cookies.php'>Cookies</a></dd> <dd><a href='/manual/en/features.sessions.php'>Sessions</a></dd> <dd><a href='/manual/en/features.file-upload.php'>Handling file uploads</a></dd> <dd><a href='/manual/en/features.remote-files.php'>Using remote files</a></dd> <dd><a href='/manual/en/features.connection-handling.php'>Connection handling</a></dd> <dd><a href='/manual/en/features.persistent-connections.php'>Persistent Database Connections</a></dd> <dd><a href='/manual/en/features.commandline.php'>Command line usage</a></dd> <dd><a href='/manual/en/features.gc.php'>Garbage Collection</a></dd> <dd><a href='/manual/en/features.dtrace.php'>DTrace Dynamic Tracing</a></dd> </dl> <dl> <dt><a href='/manual/en/funcref.php'>Function Reference</a></dt> <dd><a href='/manual/en/refs.basic.php.php'>Affecting PHP's Behaviour</a></dd> <dd><a href='/manual/en/refs.utilspec.audio.php'>Audio Formats Manipulation</a></dd> <dd><a href='/manual/en/refs.remote.auth.php'>Authentication Services</a></dd> <dd><a href='/manual/en/refs.utilspec.cmdline.php'>Command Line Specific Extensions</a></dd> <dd><a href='/manual/en/refs.compression.php'>Compression and Archive Extensions</a></dd> <dd><a href='/manual/en/refs.crypto.php'>Cryptography Extensions</a></dd> <dd><a href='/manual/en/refs.database.php'>Database Extensions</a></dd> <dd><a href='/manual/en/refs.calendar.php'>Date and Time Related Extensions</a></dd> <dd><a href='/manual/en/refs.fileprocess.file.php'>File System Related Extensions</a></dd> <dd><a href='/manual/en/refs.international.php'>Human Language and Character Encoding Support</a></dd> <dd><a href='/manual/en/refs.utilspec.image.php'>Image Processing and Generation</a></dd> <dd><a href='/manual/en/refs.remote.mail.php'>Mail Related Extensions</a></dd> <dd><a href='/manual/en/refs.math.php'>Mathematical Extensions</a></dd> <dd><a href='/manual/en/refs.utilspec.nontext.php'>Non-Text MIME Output</a></dd> <dd><a href='/manual/en/refs.fileprocess.process.php'>Process Control Extensions</a></dd> <dd><a href='/manual/en/refs.basic.other.php'>Other Basic Extensions</a></dd> <dd><a href='/manual/en/refs.remote.other.php'>Other Services</a></dd> <dd><a href='/manual/en/refs.search.php'>Search Engine Extensions</a></dd> <dd><a href='/manual/en/refs.utilspec.server.php'>Server Specific Extensions</a></dd> <dd><a href='/manual/en/refs.basic.session.php'>Session Extensions</a></dd> <dd><a href='/manual/en/refs.basic.text.php'>Text Processing</a></dd> <dd><a href='/manual/en/refs.basic.vartype.php'>Variable and Type Related Extensions</a></dd> <dd><a href='/manual/en/refs.webservice.php'>Web Services</a></dd> <dd><a href='/manual/en/refs.utilspec.windows.php'>Windows Only Extensions</a></dd> <dd><a href='/manual/en/refs.xml.php'>XML Manipulation</a></dd> <dd><a href='/manual/en/refs.ui.php'>GUI Extensions</a></dd> </dl> <dl> <dt>Keyboard Shortcuts</dt><dt>?</dt> <dd>This help</dd> <dt>j</dt> <dd>Next menu item</dd> <dt>k</dt> <dd>Previous menu item</dd> <dt>g p</dt> <dd>Previous man page</dd> <dt>g n</dt> <dd>Next man page</dd> <dt>G</dt> <dd>Scroll to bottom</dd> <dt>g g</dt> <dd>Scroll to top</dd> <dt>g h</dt> <dd>Goto homepage</dd> <dt>g s</dt> <dd>Goto search<br>(current page)</dd> <dt>/</dt> <dd>Focus search box</dd> </dl></div></nav> <div id="goto"> <div class="search"> <div class="text"></div> <div class="results"><ul></ul></div> </div> </div> <div id="breadcrumbs" class="clearfix"> <div id="breadcrumbs-inner"> <div class="next"> <a href="function.file-put-contents.php"> file_put_contents &raquo; </a> </div> <div class="prev"> <a href="function.file-exists.php"> &laquo; file_exists </a> </div> <ul> <li><a href='index.php'>PHP Manual</a></li> <li><a href='funcref.php'>Function Reference</a></li> <li><a href='refs.fileprocess.file.php'>File System Related Extensions</a></li> <li><a href='book.filesystem.php'>Filesystem</a></li> <li><a href='ref.filesystem.php'>Filesystem Functions</a></li> </ul> </div> </div> <div id="layout" class="clearfix"> <section id="layout-content"> <div class="page-tools"> <div class="change-language"> <form action="/manual/change.php" method="get" id="changelang" name="changelang"> <fieldset> <label for="changelang-langs">Change language:</label> <select onchange="document.changelang.submit()" name="page" id="changelang-langs"> <option value='en/function.file-get-contents.php' selected="selected">English</option> <option value='de/function.file-get-contents.php'>German</option> <option value='es/function.file-get-contents.php'>Spanish</option> <option value='fr/function.file-get-contents.php'>French</option> <option value='it/function.file-get-contents.php'>Italian</option> <option value='ja/function.file-get-contents.php'>Japanese</option> <option value='pt_BR/function.file-get-contents.php'>Brazilian Portuguese</option> <option value='ru/function.file-get-contents.php'>Russian</option> <option value='tr/function.file-get-contents.php'>Turkish</option> <option value='uk/function.file-get-contents.php'>Ukrainian</option> <option value='zh/function.file-get-contents.php'>Chinese (Simplified)</option> <option value='help-translate.php'>Other</option> </select> </fieldset> </form> </div> </div><div id="function.file-get-contents" class="refentry"> <div class="refnamediv"> <h1 class="refname">file_get_contents</h1> <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">file_get_contents</span> &mdash; <span class="dc-title">Reads entire file into a string</span></p> </div> <div class="refsect1 description" id="refsect1-function.file-get-contents-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="methodname"><strong>file_get_contents</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$use_include_path</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></span> <code class="parameter">$context</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$offset</code><span class="initializer"> = 0</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$length</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.value.php" class="type false">false</a></span></span></div> <p class="para rdfs-comment"> This function is similar to <span class="function"><a href="function.file.php" class="function">file()</a></span>, except that <span class="function"><strong>file_get_contents()</strong></span> returns the file in a <span class="type"><a href="language.types.string.php" class="type string">string</a></span>, starting at the specified <code class="parameter">offset</code> up to <code class="parameter">length</code> bytes. On failure, <span class="function"><strong>file_get_contents()</strong></span> will return <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. </p> <p class="para"> <span class="function"><strong>file_get_contents()</strong></span> is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> If you&#039;re opening a URI with special characters, such as spaces, you need to encode the URI with <span class="function"><a href="function.urlencode.php" class="function">urlencode()</a></span>. </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-function.file-get-contents-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt><code class="parameter">filename</code></dt> <dd> <p class="para"> Name of the file to read. </p> </dd> <dt><code class="parameter">use_include_path</code></dt> <dd> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> The <strong><code><a href="filesystem.constants.php#constant.file-use-include-path">FILE_USE_INCLUDE_PATH</a></code></strong> constant can be used to trigger <a href="ini.core.php#ini.include-path" class="link">include path</a> search. This is not possible if <a href="language.types.declarations.php#language.types.declarations.strict" class="link">strict typing</a> is enabled, since <strong><code><a href="filesystem.constants.php#constant.file-use-include-path">FILE_USE_INCLUDE_PATH</a></code></strong> is an <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>. Use <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> instead. </p> </p></blockquote> </dd> <dt><code class="parameter">context</code></dt> <dd> <p class="para"> A valid context resource created with <span class="function"><a href="function.stream-context-create.php" class="function">stream_context_create()</a></span>. If you don&#039;t need to use a custom context, you can skip this parameter by <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>. </p> </dd> <dt><code class="parameter">offset</code></dt> <dd> <p class="para"> The offset where the reading starts on the original stream. Negative offsets count from the end of the stream. </p> <p class="para"> Seeking (<code class="parameter">offset</code>) is not supported with remote files. Attempting to seek on non-local files may work with small offsets, but this is unpredictable because it works on the buffered stream. </p> </dd> <dt><code class="parameter">length</code></dt> <dd> <p class="para"> Maximum length of data read. The default is to read until end of file is reached. Note that this parameter is applied to the stream processed by the filters. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.file-get-contents-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The function returns the read data or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure. </p> <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function may return Boolean <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, but may also return a non-Boolean value which evaluates to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. Please read the section on <a href="language.types.boolean.php" class="link">Booleans</a> for more information. Use <a href="language.operators.comparison.php" class="link">the === operator</a> for testing the return value of this function.</p></div> </div> <div class="refsect1 errors" id="refsect1-function.file-get-contents-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> An <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> level error is generated if <code class="parameter">filename</code> cannot be found, <code class="parameter">length</code> is less than zero, or if seeking to the specified <code class="parameter">offset</code> in the stream fails. </p> <p class="para"> When <span class="function"><strong>file_get_contents()</strong></span> is called on a directory, an <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> level error is generated on Windows, and as of PHP 7.4 on other operating systems as well. </p> </div> <div class="refsect1 changelog" id="refsect1-function.file-get-contents-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>8.0.0</td> <td> <code class="parameter">length</code> is nullable now. </td> </tr> <tr> <td>7.1.0</td> <td> Support for negative <code class="parameter">offset</code>s has been added. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.file-get-contents-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2270"> <p><strong>Example #1 Get and output the source of the homepage of a website</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$homepage </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.example.com/'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$homepage</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div> </div> </div> <div class="example" id="example-2271"> <p><strong>Example #2 Searching within the include_path</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// If strict types are enabled i.e. declare(strict_types=1);<br /></span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'./people.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Otherwise<br /></span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'./people.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">FILE_USE_INCLUDE_PATH</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div> </div> </div> <div class="example" id="example-2272"> <p><strong>Example #3 Reading a section of a file</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Read 14 characters starting from the 21st character<br /></span><span style="color: #0000BB">$section </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'./people.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">, </span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">, </span><span style="color: #0000BB">14</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$section</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="examplescode"><pre class="examplescode">string(14) &quot;lle Bjori Ro&quot;</pre> </div> </div> </div> <div class="example" id="example-2273"> <p><strong>Example #4 Using stream contexts</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Create a stream<br /></span><span style="color: #0000BB">$opts </span><span style="color: #007700">= array(<br /> </span><span style="color: #DD0000">'http'</span><span style="color: #007700">=&gt;array(<br /> </span><span style="color: #DD0000">'method'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"GET"</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'header'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"Accept-language: en\r\n" </span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Cookie: foo=bar\r\n"<br /> </span><span style="color: #007700">)<br />);<br /><br /></span><span style="color: #0000BB">$context </span><span style="color: #007700">= </span><span style="color: #0000BB">stream_context_create</span><span style="color: #007700">(</span><span style="color: #0000BB">$opts</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Open the file using the HTTP headers set above<br /></span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.example.com/'</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">$context</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div> </div> </div> </p> </div> <div class="refsect1 notes" id="refsect1-function.file-get-contents-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">This function is binary-safe.</span></p></blockquote> <div class="tip"><strong class="tip">Tip</strong><p class="simpara">A URL can be used as a filename with this function if the <a href="filesystem.configuration.php#ini.allow-url-fopen" class="link">fopen wrappers</a> have been enabled. See <span class="function"><a href="function.fopen.php" class="function">fopen()</a></span> for more details on how to specify the filename. See the <a href="wrappers.php" class="xref">Supported Protocols and Wrappers</a> for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.</p></div> <div class="warning"><strong class="warning">Warning</strong><p class="para">When using SSL, Microsoft IIS will violate the protocol by closing the connection without sending a <code class="literal">close_notify</code> indicator. PHP will report this as &quot;SSL: Fatal Protocol Error&quot; when you reach the end of the data. To work around this, the value of <a href="errorfunc.configuration.php#ini.error-reporting" class="link">error_reporting</a> should be lowered to a level that does not include warnings. PHP can detect buggy IIS server software when you open the stream using the <code class="literal">https://</code> wrapper and will suppress the warning. When using <span class="function"><a href="function.fsockopen.php" class="function">fsockopen()</a></span> to create an <code class="literal">ssl://</code> socket, the developer is responsible for detecting and suppressing this warning.</p></div> </div> <div class="refsect1 seealso" id="refsect1-function.file-get-contents-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li><span class="function"><a href="function.file.php" class="function" rel="rdfs-seeAlso">file()</a> - Reads entire file into an array</span></li> <li><span class="function"><a href="function.fgets.php" class="function" rel="rdfs-seeAlso">fgets()</a> - Gets line from file pointer</span></li> <li><span class="function"><a href="function.fread.php" class="function" rel="rdfs-seeAlso">fread()</a> - Binary-safe file read</span></li> <li><span class="function"><a href="function.readfile.php" class="function" rel="rdfs-seeAlso">readfile()</a> - Outputs a file</span></li> <li><span class="function"><a href="function.file-put-contents.php" class="function" rel="rdfs-seeAlso">file_put_contents()</a> - Write data to a file</span></li> <li><span class="function"><a href="function.stream-get-contents.php" class="function" rel="rdfs-seeAlso">stream_get_contents()</a> - Reads remainder of a stream into a string</span></li> <li><span class="function"><a href="function.stream-context-create.php" class="function" rel="rdfs-seeAlso">stream_context_create()</a> - Creates a stream context</span></li> <li><a href="reserved.variables.httpresponseheader.php" class="link">$http_response_header</a></li> </ul> </p> </div> </div> <div class="contribute"> <h3 class="title">Found A Problem?</h3> <div> </div> <div class="edit-bug"> <a href="https://github.com/php/doc-base/blob/master/README.md" title="This will take you to our contribution guidelines on GitHub" target="_blank" rel="noopener noreferrer">Learn How To Improve This Page</a> • <a href="https://github.com/php/doc-en/blob/master/reference/filesystem/functions/file-get-contents.xml">Submit a Pull Request</a> • <a href="https://github.com/php/doc-en/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2Ffunction.file-get-contents%0A%0A---">Report a Bug</a> </div> </div><section id="usernotes"> <div class="head"> <span class="action"><a href="/manual/add-note.php?sect=function.file-get-contents&amp;repo=en&amp;redirect=https://www.php.net/manual/en/function.file-get-contents.php">+<small>add a note</small></a></span> <h3 class="title">User Contributed Notes <span class="count">6 notes</span></h3> </div><div id="allnotes"> <div class="note" id="108309"> <div class="votes"> <div id="Vu108309"> <a href="/manual/vote-note.php?id=108309&amp;page=function.file-get-contents&amp;vote=up" title="Vote up!" class="usernotes-voteu">up</a> </div> <div id="Vd108309"> <a href="/manual/vote-note.php?id=108309&amp;page=function.file-get-contents&amp;vote=down" title="Vote down!" class="usernotes-voted">down</a> </div> <div class="tally" id="V108309" title="51% like this..."> 39 </div> </div> <a href="#108309" class="name"> <strong class="user"><em>Bart Friederichs</em></strong></a><a class="genanchor" href="#108309"> &para;</a><div class="date" title="2012-04-16 12:17"><strong>12 years ago</strong></div> <div class="text" id="Hcom108309"> <div class="phpcode"><code><span class="html">file_get_contents can do a POST, create a context for that first: <br /> <br /><span class="default">&lt;?php <br /> <br />$opts </span><span class="keyword">= array(</span><span class="string">'http' </span><span class="keyword">=&gt; <br /> array( <br /> </span><span class="string">'method' </span><span class="keyword">=&gt; </span><span class="string">'POST'</span><span class="keyword">, <br /> </span><span class="string">'header' </span><span class="keyword">=&gt; </span><span class="string">"Content-Type: text/xml\r\n"</span><span class="keyword">. <br /> </span><span class="string">"Authorization: Basic "</span><span class="keyword">.</span><span class="default">base64_encode</span><span class="keyword">(</span><span class="string">"</span><span class="default">$https_user</span><span class="string">:</span><span class="default">$https_password</span><span class="string">"</span><span class="keyword">).</span><span class="string">"\r\n"</span><span class="keyword">, <br /> </span><span class="string">'content' </span><span class="keyword">=&gt; </span><span class="default">$body</span><span class="keyword">, <br /> </span><span class="string">'timeout' </span><span class="keyword">=&gt; </span><span class="default">60 <br /> </span><span class="keyword">) <br />); <br /> <br /></span><span class="default">$context </span><span class="keyword">= </span><span class="default">stream_context_create</span><span class="keyword">(</span><span class="default">$opts</span><span class="keyword">); <br /></span><span class="default">$url </span><span class="keyword">= </span><span class="string">'<a href="https://" rel="nofollow" target="_blank">https://</a>'</span><span class="keyword">.</span><span class="default">$https_server</span><span class="keyword">; <br /></span><span class="default">$result </span><span class="keyword">= </span><span class="default">file_get_contents</span><span class="keyword">(</span><span class="default">$url</span><span class="keyword">, </span><span class="default">false</span><span class="keyword">, </span><span class="default">$context</span><span class="keyword">, -</span><span class="default">1</span><span class="keyword">, </span><span class="default">40000</span><span class="keyword">); <br /> <br /></span><span class="default">?&gt;</span></span></code></div> </div> </div> <div class="note" id="128784"> <div class="votes"> <div id="Vu128784"> <a href="/manual/vote-note.php?id=128784&amp;page=function.file-get-contents&amp;vote=up" title="Vote up!" class="usernotes-voteu">up</a> </div> <div id="Vd128784"> <a href="/manual/vote-note.php?id=128784&amp;page=function.file-get-contents&amp;vote=down" title="Vote down!" class="usernotes-voted">down</a> </div> <div class="tally" id="V128784" title="60% like this..."> 5 </div> </div> <a href="#128784" class="name"> <strong class="user"><em>brentcontact at daha dot us</em></strong></a><a class="genanchor" href="#128784"> &para;</a><div class="date" title="2023-08-08 10:55"><strong>1 year ago</strong></div> <div class="text" id="Hcom128784"> <div class="phpcode"><code><span class="html">To prevent mixed content most browsers/functions will use the protocol already used if you specify only // instead of <a href="http://" rel="nofollow" target="_blank">http://</a> or <a href="https://." rel="nofollow" target="_blank">https://.</a> This is not the case with file_get_contents. You must specify the protocol. <br /><br />This does not work:<br /><span class="default">&lt;?php<br />$jsonData </span><span class="keyword">= </span><span class="default">file_get_contents</span><span class="keyword">(</span><span class="string">'//example.com/file.json'</span><span class="keyword">);<br />print </span><span class="default">$jsonData</span><span class="keyword">;<br /></span><span class="default">?&gt;<br /></span><br />Specifying only 'example.com/file.json' without the double slash does not work either.<br /><br />When running on Apache 2.4 , using $_SERVER['REQUEST_SCHEME'] is a better way to be protocol agnostic.<br /><span class="default">&lt;?php<br />$jsonData </span><span class="keyword">= </span><span class="default">file_get_contents</span><span class="keyword">(</span><span class="default">$_SERVER</span><span class="keyword">[</span><span class="string">'REQUEST_SCHEME'</span><span class="keyword">].</span><span class="string">'://example.com/file.json'</span><span class="keyword">);<br />print </span><span class="default">$jsonData</span><span class="keyword">;<br /></span><span class="default">?&gt;<br /></span><br />If using another web server, you may have to get the protocol another way or hard code it.</span></code></div> </div> </div> <div class="note" id="129074"> <div class="votes"> <div id="Vu129074"> <a href="/manual/vote-note.php?id=129074&amp;page=function.file-get-contents&amp;vote=up" title="Vote up!" class="usernotes-voteu">up</a> </div> <div id="Vd129074"> <a href="/manual/vote-note.php?id=129074&amp;page=function.file-get-contents&amp;vote=down" title="Vote down!" class="usernotes-voted">down</a> </div> <div class="tally" id="V129074" title="59% like this..."> 4 </div> </div> <a href="#129074" class="name"> <strong class="user"><em>KC</em></strong></a><a class="genanchor" href="#129074"> &para;</a><div class="date" title="2023-11-29 01:58"><strong>1 year ago</strong></div> <div class="text" id="Hcom129074"> <div class="phpcode"><code><span class="html">If doing a negative offset to grab the end of a file and the file is shorter than the offset, then file_get_contents( ) will return false.<br /><br />If you want it to just return what is available when the file is shorter than the negative offset, you could try again.<br /><br />For example...<br /><br />$contents = file_get_contents( $log_file, false, null, -4096 ); // Get last 4KB<br /><br />if ( false === $contents ) {<br /> // Maybe error, or maybe file less than 4KB in size.<br /><br /> $contents = file_get_contents( $log_file, false, null );<br /><br /> if ( false === $contents ) {<br /> // Handle real error.<br /> }<br />}</span></code></div> </div> </div> <div class="note" id="130027"> <div class="votes"> <div id="Vu130027"> <a href="/manual/vote-note.php?id=130027&amp;page=function.file-get-contents&amp;vote=up" title="Vote up!" class="usernotes-voteu">up</a> </div> <div id="Vd130027"> <a href="/manual/vote-note.php?id=130027&amp;page=function.file-get-contents&amp;vote=down" title="Vote down!" class="usernotes-voted">down</a> </div> <div class="tally" id="V130027" title="100% like this..."> 1 </div> </div> <a href="#130027" class="name"> <strong class="user"><em>julien at pixeye dot net</em></strong></a><a class="genanchor" href="#130027"> &para;</a><div class="date" title="2025-02-14 12:25"><strong>15 days ago</strong></div> <div class="text" id="Hcom130027"> <div class="phpcode"><code><span class="html">See also: http_get_last_response_headers() function to get last HTTP response headers including the HTTP response status code (200, 404, ...)</span></code></div> </div> </div> <div class="note" id="127655"> <div class="votes"> <div id="Vu127655"> <a href="/manual/vote-note.php?id=127655&amp;page=function.file-get-contents&amp;vote=up" title="Vote up!" class="usernotes-voteu">up</a> </div> <div id="Vd127655"> <a href="/manual/vote-note.php?id=127655&amp;page=function.file-get-contents&amp;vote=down" title="Vote down!" class="usernotes-voted">down</a> </div> <div class="tally" id="V127655" title="48% like this..."> -2 </div> </div> <a href="#127655" class="name"> <strong class="user"><em>soger</em></strong></a><a class="genanchor" href="#127655"> &para;</a><div class="date" title="2022-09-20 12:54"><strong>2 years ago</strong></div> <div class="text" id="Hcom127655"> <div class="phpcode"><code><span class="html">There's barely a mention on this page but the $http_response_header will be populated with the HTTP headers if your file was a link. For example if you're expecting an image you can do this:<br /><br /><span class="default">&lt;?php<br />$data </span><span class="keyword">= </span><span class="default">file_get_contents</span><span class="keyword">(</span><span class="string">'<a href="https://example.net/some-link" rel="nofollow" target="_blank">https://example.net/some-link</a>'</span><span class="keyword">);<br /><br /></span><span class="default">$mimetype </span><span class="keyword">= </span><span class="default">null</span><span class="keyword">;<br />foreach (</span><span class="default">$http_response_header </span><span class="keyword">as </span><span class="default">$v</span><span class="keyword">) {<br /> if (</span><span class="default">preg_match</span><span class="keyword">(</span><span class="string">'/^content\-type:\s*(image\/[^;\s\n\r]+)/i'</span><span class="keyword">, </span><span class="default">$v</span><span class="keyword">, </span><span class="default">$m</span><span class="keyword">)) {<br /> </span><span class="default">$mimetype </span><span class="keyword">= </span><span class="default">$m</span><span class="keyword">[</span><span class="default">1</span><span class="keyword">];<br /> }<br />}<br /><br />if (!</span><span class="default">$mimetype</span><span class="keyword">) {<br /> </span><span class="comment">// not an image<br /></span><span class="keyword">}</span></span></code></div> </div> </div> <div class="note" id="128313"> <div class="votes"> <div id="Vu128313"> <a href="/manual/vote-note.php?id=128313&amp;page=function.file-get-contents&amp;vote=up" title="Vote up!" class="usernotes-voteu">up</a> </div> <div id="Vd128313"> <a href="/manual/vote-note.php?id=128313&amp;page=function.file-get-contents&amp;vote=down" title="Vote down!" class="usernotes-voted">down</a> </div> <div class="tally" id="V128313" title="46% like this..."> -2 </div> </div> <a href="#128313" class="name"> <strong class="user"><em>daniel at dangarbri dot tech</em></strong></a><a class="genanchor" href="#128313"> &para;</a><div class="date" title="2023-03-16 04:20"><strong>1 year ago</strong></div> <div class="text" id="Hcom128313"> <div class="phpcode"><code><span class="html">Note that if an HTTP request fails but still has a response body, the result is still false, Not the response body which may have more details on why the request failed.</span></code></div> </div> </div></div> <div class="foot"><a href="/manual/add-note.php?sect=function.file-get-contents&amp;repo=en&amp;redirect=https://www.php.net/manual/en/function.file-get-contents.php">+<small>add a note</small></a></div> </section> </section><!-- layout-content --> <aside class='layout-menu'> <ul class='parent-menu-list'> <li> <a href="ref.filesystem.php">Filesystem Functions</a> <ul class='child-menu-list'> <li class=""> <a href="function.basename.php" title="basename">basename</a> </li> <li class=""> <a href="function.chgrp.php" title="chgrp">chgrp</a> </li> <li class=""> <a href="function.chmod.php" title="chmod">chmod</a> </li> <li class=""> <a href="function.chown.php" title="chown">chown</a> </li> <li class=""> <a href="function.clearstatcache.php" title="clearstatcache">clearstatcache</a> </li> <li class=""> <a href="function.copy.php" title="copy">copy</a> </li> <li class=""> <a href="function.delete.php" title="delete">delete</a> </li> <li class=""> <a href="function.dirname.php" title="dirname">dirname</a> </li> <li class=""> <a href="function.disk-free-space.php" title="disk_&#8203;free_&#8203;space">disk_&#8203;free_&#8203;space</a> </li> <li class=""> <a href="function.disk-total-space.php" title="disk_&#8203;total_&#8203;space">disk_&#8203;total_&#8203;space</a> </li> <li class=""> <a href="function.diskfreespace.php" title="diskfreespace">diskfreespace</a> </li> <li class=""> <a href="function.fclose.php" title="fclose">fclose</a> </li> <li class=""> <a href="function.fdatasync.php" title="fdatasync">fdatasync</a> </li> <li class=""> <a href="function.feof.php" title="feof">feof</a> </li> <li class=""> <a href="function.fflush.php" title="fflush">fflush</a> </li> <li class=""> <a href="function.fgetc.php" title="fgetc">fgetc</a> </li> <li class=""> <a href="function.fgetcsv.php" title="fgetcsv">fgetcsv</a> </li> <li class=""> <a href="function.fgets.php" title="fgets">fgets</a> </li> <li class=""> <a href="function.fgetss.php" title="fgetss">fgetss</a> </li> <li class=""> <a href="function.file.php" title="file">file</a> </li> <li class=""> <a href="function.file-exists.php" title="file_&#8203;exists">file_&#8203;exists</a> </li> <li class="current"> <a href="function.file-get-contents.php" title="file_&#8203;get_&#8203;contents">file_&#8203;get_&#8203;contents</a> </li> <li class=""> <a href="function.file-put-contents.php" title="file_&#8203;put_&#8203;contents">file_&#8203;put_&#8203;contents</a> </li> <li class=""> <a href="function.fileatime.php" title="fileatime">fileatime</a> </li> <li class=""> <a href="function.filectime.php" title="filectime">filectime</a> </li> <li class=""> <a href="function.filegroup.php" title="filegroup">filegroup</a> </li> <li class=""> <a href="function.fileinode.php" title="fileinode">fileinode</a> </li> <li class=""> <a href="function.filemtime.php" title="filemtime">filemtime</a> </li> <li class=""> <a href="function.fileowner.php" title="fileowner">fileowner</a> </li> <li class=""> <a href="function.fileperms.php" title="fileperms">fileperms</a> </li> <li class=""> <a href="function.filesize.php" title="filesize">filesize</a> </li> <li class=""> <a href="function.filetype.php" title="filetype">filetype</a> </li> <li class=""> <a href="function.flock.php" title="flock">flock</a> </li> <li class=""> <a href="function.fnmatch.php" title="fnmatch">fnmatch</a> </li> <li class=""> <a href="function.fopen.php" title="fopen">fopen</a> </li> <li class=""> <a href="function.fpassthru.php" title="fpassthru">fpassthru</a> </li> <li class=""> <a href="function.fputcsv.php" title="fputcsv">fputcsv</a> </li> <li class=""> <a href="function.fputs.php" title="fputs">fputs</a> </li> <li class=""> <a href="function.fread.php" title="fread">fread</a> </li> <li class=""> <a href="function.fscanf.php" title="fscanf">fscanf</a> </li> <li class=""> <a href="function.fseek.php" title="fseek">fseek</a> </li> <li class=""> <a href="function.fstat.php" title="fstat">fstat</a> </li> <li class=""> <a href="function.fsync.php" title="fsync">fsync</a> </li> <li class=""> <a href="function.ftell.php" title="ftell">ftell</a> </li> <li class=""> <a href="function.ftruncate.php" title="ftruncate">ftruncate</a> </li> <li class=""> <a href="function.fwrite.php" title="fwrite">fwrite</a> </li> <li class=""> <a href="function.glob.php" title="glob">glob</a> </li> <li class=""> <a href="function.is-dir.php" title="is_&#8203;dir">is_&#8203;dir</a> </li> <li class=""> <a href="function.is-executable.php" title="is_&#8203;executable">is_&#8203;executable</a> </li> <li class=""> <a href="function.is-file.php" title="is_&#8203;file">is_&#8203;file</a> </li> <li class=""> <a href="function.is-link.php" title="is_&#8203;link">is_&#8203;link</a> </li> <li class=""> <a href="function.is-readable.php" title="is_&#8203;readable">is_&#8203;readable</a> </li> <li class=""> <a href="function.is-uploaded-file.php" title="is_&#8203;uploaded_&#8203;file">is_&#8203;uploaded_&#8203;file</a> </li> <li class=""> <a href="function.is-writable.php" title="is_&#8203;writable">is_&#8203;writable</a> </li> <li class=""> <a href="function.is-writeable.php" title="is_&#8203;writeable">is_&#8203;writeable</a> </li> <li class=""> <a href="function.lchgrp.php" title="lchgrp">lchgrp</a> </li> <li class=""> <a href="function.lchown.php" title="lchown">lchown</a> </li> <li class=""> <a href="function.link.php" title="link">link</a> </li> <li class=""> <a href="function.linkinfo.php" title="linkinfo">linkinfo</a> </li> <li class=""> <a href="function.lstat.php" title="lstat">lstat</a> </li> <li class=""> <a href="function.mkdir.php" title="mkdir">mkdir</a> </li> <li class=""> <a href="function.move-uploaded-file.php" title="move_&#8203;uploaded_&#8203;file">move_&#8203;uploaded_&#8203;file</a> </li> <li class=""> <a href="function.parse-ini-file.php" title="parse_&#8203;ini_&#8203;file">parse_&#8203;ini_&#8203;file</a> </li> <li class=""> <a href="function.parse-ini-string.php" title="parse_&#8203;ini_&#8203;string">parse_&#8203;ini_&#8203;string</a> </li> <li class=""> <a href="function.pathinfo.php" title="pathinfo">pathinfo</a> </li> <li class=""> <a href="function.pclose.php" title="pclose">pclose</a> </li> <li class=""> <a href="function.popen.php" title="popen">popen</a> </li> <li class=""> <a href="function.readfile.php" title="readfile">readfile</a> </li> <li class=""> <a href="function.readlink.php" title="readlink">readlink</a> </li> <li class=""> <a href="function.realpath.php" title="realpath">realpath</a> </li> <li class=""> <a href="function.realpath-cache-get.php" title="realpath_&#8203;cache_&#8203;get">realpath_&#8203;cache_&#8203;get</a> </li> <li class=""> <a href="function.realpath-cache-size.php" title="realpath_&#8203;cache_&#8203;size">realpath_&#8203;cache_&#8203;size</a> </li> <li class=""> <a href="function.rename.php" title="rename">rename</a> </li> <li class=""> <a href="function.rewind.php" title="rewind">rewind</a> </li> <li class=""> <a href="function.rmdir.php" title="rmdir">rmdir</a> </li> <li class=""> <a href="function.set-file-buffer.php" title="set_&#8203;file_&#8203;buffer">set_&#8203;file_&#8203;buffer</a> </li> <li class=""> <a href="function.stat.php" title="stat">stat</a> </li> <li class=""> <a href="function.symlink.php" title="symlink">symlink</a> </li> <li class=""> <a href="function.tempnam.php" title="tempnam">tempnam</a> </li> <li class=""> <a href="function.tmpfile.php" title="tmpfile">tmpfile</a> </li> <li class=""> <a href="function.touch.php" title="touch">touch</a> </li> <li class=""> <a href="function.umask.php" title="umask">umask</a> </li> <li class=""> <a href="function.unlink.php" title="unlink">unlink</a> </li> </ul> </li> </ul> </aside> </div><!-- layout --> <footer> <div class="container footer-content"> <div class="row-fluid"> <ul class="footmenu"> <li><a href="/manual/en/copyright.php">Copyright &copy; 2001-2025 The PHP Documentation Group</a></li> <li><a href="/my.php">My PHP.net</a></li> <li><a href="/contact.php">Contact</a></li> <li><a href="/sites.php">Other PHP.net sites</a></li> <li><a href="/privacy.php">Privacy policy</a></li> </ul> </div> </div> </footer> <script src="/cached.php?t=1731172202&amp;f=/js/ext/jquery-3.6.0.min.js"></script> <script src="/cached.php?t=1723177202&amp;f=/js/ext/FuzzySearch.min.js"></script> <script src="/cached.php?t=1707321815&amp;f=/js/ext/mousetrap.min.js"></script> <script src="/cached.php?t=1707321815&amp;f=/js/ext/jquery.scrollTo.min.js"></script> <script src="/cached.php?t=1738028401&amp;f=/js/search.js"></script> <script src="/cached.php?t=1738742401&amp;f=/js/common.js"></script> <script type="module" src="/cached.php?t=1738318202&amp;f=/js/interactive-examples.js"></script> <a id="toTop" href="javascript:;"><span id="toTopHover"></span><img width="40" height="40" alt="To Top" src="/images/to-top@2x.png"></a> <div id="search-modal__backdrop" class="search-modal__backdrop"> <div role="dialog" aria-label="Search modal" id="search-modal" class="search-modal" > <div class="search-modal__header"> <div class="search-modal__form"> <div class="search-modal__input-icon"> <!-- https://feathericons.com search --> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" > <circle cx="11" cy="11" r="8"></circle> <line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> </div> <input type="search" id="search-modal__input" class="search-modal__input" placeholder="Search docs" aria-label="Search docs" /> </div> <button aria-label="Close" class="search-modal__close"> <!-- https://pictogrammers.com/library/mdi/icon/close/ --> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" viewBox="0 0 24 24" > <path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/> </svg> </button> </div> <div role="listbox" aria-label="Search results" id="search-modal__results" class="search-modal__results" ></div> <div class="search-modal__helper-text"> <div> <kbd>↑</kbd> and <kbd>↓</kbd> to navigate • <kbd>Enter</kbd> to select • <kbd>Esc</kbd> to close </div> <div> Press <kbd>Enter</kbd> without selection to search using Google </div> </div> </div> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10