<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.yaml.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.yaml-parse.php',
    1 => 'yaml_parse',
    2 => 'Parse a YAML stream',
  ),
  'up' => 
  array (
    0 => 'ref.yaml.php',
    1 => 'Yaml Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.yaml-emit-file.php',
    1 => 'yaml_emit_file',
  ),
  'next' => 
  array (
    0 => 'function.yaml-parse-file.php',
    1 => 'yaml_parse_file',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yaml/functions/yaml-parse.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.yaml-parse" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">yaml_parse</h1>
  <p class="verinfo">(PECL yaml &gt;= 0.4.0)</p><p class="refpurpose"><span class="refname">yaml_parse</span> &mdash; <span class="dc-title">Parse a YAML stream</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.yaml-parse-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>yaml_parse</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">$input</code></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">$pos</code><span class="initializer"> = 0</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 reference">&$ndocs</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$callbacks</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
   Convert all or part of a YAML document stream to a PHP variable.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.yaml-parse-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">input</code></dt>
     <dd>
      <p class="para">
       The <span class="type"><a href="language.types.string.php" class="type string">string</a></span> to parse as a YAML document stream.
      </p>
     </dd>
    
    
     <dt><code class="parameter">pos</code></dt>
     <dd>
      <p class="para">
       Document to extract from stream (<code class="literal">-1</code> for all
       documents, <code class="literal">0</code> for first document, ...).
      </p>
     </dd>
    
    
     <dt><code class="parameter">ndocs</code></dt>
     <dd>
      <p class="para">
       If <code class="parameter">ndocs</code> is provided, then it is filled with the
       number of documents found in stream.
      </p>
     </dd>
    
    
     <dt><code class="parameter">callbacks</code></dt>
     <dd>
      <p class="para">
       Content handlers for YAML nodes. Associative <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of YAML
       tag =&gt; <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> mappings. See
       <a href="yaml.callbacks.parse.php" class="link">parse callbacks</a> for more
       details.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.yaml-parse-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Returns the value encoded in <code class="parameter">input</code> in appropriate
   PHP typeBei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.. If <code class="parameter">pos</code> is <code class="literal">-1</code> an
   <span class="type"><a href="language.types.array.php" class="type array">array</a></span> will be returned with one entry for each document found
   in the stream.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.yaml-parse-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>yaml_parse()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$yaml </span><span style="color: #007700">= &lt;&lt;&lt;EOD<br /></span><span style="color: #DD0000">---<br />invoice: 34843<br />date: "2001-01-23"<br />bill-to: &amp;id001<br />  given: Chris<br />  family: Dumars<br />  address:<br />    lines: |-<br />      458 Walkman Dr.<br />              Suite #292<br />    city: Royal Oak<br />    state: MI<br />    postal: 48046<br />ship-to: *id001<br />product:<br />- sku: BL394D<br />  quantity: 4<br />  description: Basketball<br />  price: 450<br />- sku: BL4438H<br />  quantity: 1<br />  description: Super Hoop<br />  price: 2392<br />tax: 251.420000<br />total: 4443.520000<br />comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.<br />...<br /></span><span style="color: #007700">EOD;<br /><br /></span><span style="color: #0000BB">$parsed </span><span style="color: #007700">= </span><span style="color: #0000BB">yaml_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$yaml</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$parsed</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(8) {
  [&quot;invoice&quot;]=&gt;
  int(34843)
  [&quot;date&quot;]=&gt;
  string(10) &quot;2001-01-23&quot;
  [&quot;bill-to&quot;]=&gt;
  &amp;array(3) {
    [&quot;given&quot;]=&gt;
    string(5) &quot;Chris&quot;
    [&quot;family&quot;]=&gt;
    string(6) &quot;Dumars&quot;
    [&quot;address&quot;]=&gt;
    array(4) {
      [&quot;lines&quot;]=&gt;
      string(34) &quot;458 Walkman Dr.
        Suite #292&quot;
      [&quot;city&quot;]=&gt;
      string(9) &quot;Royal Oak&quot;
      [&quot;state&quot;]=&gt;
      string(2) &quot;MI&quot;
      [&quot;postal&quot;]=&gt;
      int(48046)
    }
  }
  [&quot;ship-to&quot;]=&gt;
  &amp;array(3) {
    [&quot;given&quot;]=&gt;
    string(5) &quot;Chris&quot;
    [&quot;family&quot;]=&gt;
    string(6) &quot;Dumars&quot;
    [&quot;address&quot;]=&gt;
    array(4) {
      [&quot;lines&quot;]=&gt;
      string(34) &quot;458 Walkman Dr.
        Suite #292&quot;
      [&quot;city&quot;]=&gt;
      string(9) &quot;Royal Oak&quot;
      [&quot;state&quot;]=&gt;
      string(2) &quot;MI&quot;
      [&quot;postal&quot;]=&gt;
      int(48046)
    }
  }
  [&quot;product&quot;]=&gt;
  array(2) {
    [0]=&gt;
    array(4) {
      [&quot;sku&quot;]=&gt;
      string(6) &quot;BL394D&quot;
      [&quot;quantity&quot;]=&gt;
      int(4)
      [&quot;description&quot;]=&gt;
      string(10) &quot;Basketball&quot;
      [&quot;price&quot;]=&gt;
      int(450)
    }
    [1]=&gt;
    array(4) {
      [&quot;sku&quot;]=&gt;
      string(7) &quot;BL4438H&quot;
      [&quot;quantity&quot;]=&gt;
      int(1)
      [&quot;description&quot;]=&gt;
      string(10) &quot;Super Hoop&quot;
      [&quot;price&quot;]=&gt;
      int(2392)
    }
  }
  [&quot;tax&quot;]=&gt;
  float(251.42)
  [&quot;total&quot;]=&gt;
  float(4443.52)
  [&quot;comments&quot;]=&gt;
  string(68) &quot;Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.&quot;
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.yaml-parse-notes">
  <h3 class="title">Anmerkungen</h3>
  <div class="warning"><strong class="warning">Warnung</strong>
   <p class="para">
    Processing untrusted user input with <span class="function"><strong>yaml_parse()</strong></span>
    is dangerous if the use of <span class="function"><a href="function.unserialize.php" class="function">unserialize()</a></span> is enabled for
    nodes using the <code class="literal">!php/object</code> tag. This behavior can be
    disabled by using the <code class="literal">yaml.decode_php</code> ini setting.
   </p>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.yaml-parse-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.yaml-parse-file.php" class="function" rel="rdfs-seeAlso">yaml_parse_file()</a> - Parse a YAML stream from a file</span></li>
    <li><span class="function"><a href="function.yaml-parse-url.php" class="function" rel="rdfs-seeAlso">yaml_parse_url()</a> - Parse a Yaml stream from a URL</span></li>
    <li><span class="function"><a href="function.yaml-emit.php" class="function" rel="rdfs-seeAlso">yaml_emit()</a> - Returns the YAML representation of a value</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>