<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Parse a YAML stream from a file</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.yaml-emit.html">yaml_emit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.yaml-parse-url.html">yaml_parse_url</a></div> <div class="up"><a href="ref.yaml.html">Yaml Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.yaml-parse-file" class="refentry"> <div class="refnamediv"> <h1 class="refname">yaml_parse_file</h1> <p class="verinfo">(PECL yaml >= 0.4.0)</p><p class="refpurpose"><span class="refname">yaml_parse_file</span> — <span class="dc-title">Parse a YAML stream from a file</span></p> </div> <div class="refsect1 description" id="refsect1-function.yaml-parse-file-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>yaml_parse_file</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$pos</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$ndocs</code></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$callbacks</code></span> ]]] )</div> <p class="para rdfs-comment"> Convert all or part of a YAML document stream read from a file to a PHP variable. </p> </div> <div class="refsect1 parameters" id="refsect1-function.yaml-parse-file-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">filename</code></em></span> <dd> <p class="para"> Path to the file. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">pos</code></em></span> <dd> <p class="para"> Document to extract from stream (<em>-1</em> for all documents, <em>0</em> for first document, ...). </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">ndocs</code></em></span> <dd> <p class="para"> If <em><code class="parameter">ndocs</code></em> is provided, then it is filled with the number of documents found in stream. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">callbacks</code></em></span> <dd> <p class="para"> Content handlers for YAML nodes. Associative <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of YAML tag => <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> mappings. See <a href="yaml.callbacks.parse.html" class="link">parse callbacks</a> for more details. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.yaml-parse-file-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the value encoded in <em><code class="parameter">input</code></em> in appropriate PHP type or <strong><code>FALSE</code></strong> on failure. If <em><code class="parameter">pos</code></em> is <em>-1</em> an <span class="type"><a href="language.types.array.html" class="type array">array</a></span> will be returned with one entry for each document found in the stream. </p> </div> <div class="refsect1 seealso" id="refsect1-function.yaml-parse-file-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.yaml-parse.html" class="function" rel="rdfs-seeAlso">yaml_parse()</a> - Parse a YAML stream</span></li> <li class="member"> <span class="function"><a href="function.yaml-parse-url.html" class="function" rel="rdfs-seeAlso">yaml_parse_url()</a> - Parse a Yaml stream from a URL</span></li> <li class="member"> <span class="function"><a href="function.yaml-emit.html" class="function" rel="rdfs-seeAlso">yaml_emit()</a> - Returns the YAML representation of a value</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.yaml-emit.html">yaml_emit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.yaml-parse-url.html">yaml_parse_url</a></div> <div class="up"><a href="ref.yaml.html">Yaml Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>