<!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>Send the YAML representation of a value to a file</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.yaml.html">Yaml Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.yaml-emit.html">yaml_emit</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-emit-file" class="refentry"> <div class="refnamediv"> <h1 class="refname">yaml_emit_file</h1> <p class="verinfo">(PECL yaml >= 0.5.0)</p><p class="refpurpose"><span class="refname">yaml_emit_file</span> — <span class="dc-title">Send the YAML representation of a value to a file</span></p> </div> <div class="refsect1 description" id="refsect1-function.yaml-emit-file-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>yaml_emit_file</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$encoding</code><span class="initializer"> = YAML_ANY_ENCODING</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$linebreak</code><span class="initializer"> = YAML_ANY_BREAK</span></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$callbacks</code></span> ]]] )</div> <p class="para rdfs-comment"> Generate a YAML representation of the provided <em><code class="parameter">data</code></em> in the <em><code class="parameter">filename</code></em>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.yaml-emit-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">data</code></em></span> <dd> <p class="para"> The <em><code class="parameter">data</code></em> being encoded. Can be any type except a <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">encoding</code></em></span> <dd> <p class="para"> Output character encoding chosen from <strong><code>YAML_ANY_ENCODING</code></strong>, <strong><code>YAML_UTF8_ENCODING</code></strong>, <strong><code>YAML_UTF16LE_ENCODING</code></strong>, <strong><code>YAML_UTF16BE_ENCODING</code></strong>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">linebreak</code></em></span> <dd> <p class="para"> Output linebreak style chosen from <strong><code>YAML_ANY_BREAK</code></strong>, <strong><code>YAML_CR_BREAK</code></strong>, <strong><code>YAML_LN_BREAK</code></strong>, <strong><code>YAML_CRLN_BREAK</code></strong>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">callbacks</code></em></span> <dd> <p class="para"> Content handlers for emitting YAML nodes. Associative <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of classname => <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> mappings. See <a href="yaml.callbacks.emit.html" class="link">emit callbacks</a> for more details. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.yaml-emit-file-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success. </p> </div> <div class="refsect1 changelog" id="refsect1-function.yaml-emit-file-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>1.1.0</td> <td> The <em><code class="parameter">callbacks</code></em> parameter was added. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-function.yaml-emit-file-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <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> <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> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.yaml.html">Yaml Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.yaml-emit.html">yaml_emit</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>