<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.domdocumentfragment.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'domdocumentfragment.prepend.php',
    1 => 'DOMDocumentFragment::prepend',
    2 => 'Ajoute des n&oelig;uds avant le premier n&oelig;ud enfant',
  ),
  'up' => 
  array (
    0 => 'class.domdocumentfragment.php',
    1 => 'DOMDocumentFragment',
  ),
  'prev' => 
  array (
    0 => 'domdocumentfragment.construct.php',
    1 => 'DOMDocumentFragment::__construct',
  ),
  'next' => 
  array (
    0 => 'domdocumentfragment.replacechildren.php',
    1 => 'DOMDocumentFragment::replaceChildren',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/dom/domdocumentfragment/prepend.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="domdocumentfragment.prepend" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMDocumentFragment::prepend</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">DOMDocumentFragment::prepend</span> &mdash; <span class="dc-title">Ajoute des nœuds avant le premier nœud enfant</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-domdocumentfragment.prepend-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>DOMDocumentFragment::prepend</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.domnode.php" class="type DOMNode">DOMNode</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">...$nodes</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Ajoute un ou plusieurs <code class="parameter">nodes</code> à la liste des enfants avant le premier nœud enfant.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-domdocumentfragment.prepend-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">nodes</code></dt>
     <dd>
      <p class="para">
       Les nœuds à ajouter.
       Les chaînes de caractères sont automatiquement converties en des nœuds de texte.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-domdocumentfragment.prepend-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Aucune valeur n&#039;est retournée.
  </p>
 </div>

 <div class="refsect1 errors" id="refsect1-domdocumentfragment.prepend-errors">
  <h3 class="title">Erreurs / Exceptions</h3>
  <dl>
   
 <dt><strong><code><a href="dom.constants.php#constant.dom-hierarchy-request-err">DOM_HIERARCHY_REQUEST_ERR</a></code></strong></dt>
  <dd>
  <p class="para">
    Levée si ce nœud est d&#039;un type qui n&#039;autorise pas les enfants du
    type de l&#039;un des <code class="parameter">nodes</code> transmis, ou si le nœud à
    insérer est l&#039;un des ancêtres de ce nœud ou ce nœud lui-même.
  </p>
 </dd>

   
 <dt><strong><code><a href="dom.constants.php#constant.dom-wrong-document-err">DOM_WRONG_DOCUMENT_ERR</a></code></strong></dt>
  <dd>
  <p class="para">
    Levée si l&#039;un des <code class="parameter">nodes</code> transmis a été créé à partir d&#039;un document différent
    de celui qui a créé ce nœud.
  </p>
 </dd>

  </dl>
 </div>

 <div class="refsect1 changelog" id="refsect1-domdocumentfragment.prepend-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.3.0</td>
      <td>
       Appeler cette méthode sur un nœud sans document propriétaire fonctionne désormais.
       Auparavant, cela déclenchait une
 <span class="classname"><a href="class.domexception.php" class="classname">DOMException</a></span> avec le code
 <strong><code><a href="dom.constants.php#constant.dom-hierarchy-request-err">DOM_HIERARCHY_REQUEST_ERR</a></code></strong>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-domdocumentfragment.prepend-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="domdocumentfragment.prepend.example.basic">
   <p><strong>Exemple #1 Exemple de <span class="methodname"><strong>DOMDocumentFragment::prepend()</strong></span></strong></p>
   <div class="example-contents"><p>
    Ajoute des nœuds avant le fragment racine.
   </p></div>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$doc </span><span style="color: #007700">= new </span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$fragment </span><span style="color: #007700">= </span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDocumentFragment</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$fragment</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">appendChild</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createElement</span><span style="color: #007700">(</span><span style="color: #DD0000">"world"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$fragment</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">prepend</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createElement</span><span style="color: #007700">(</span><span style="color: #DD0000">"hello"</span><span style="color: #007700">), </span><span style="color: #DD0000">"beautiful"</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveXML</span><span style="color: #007700">(</span><span style="color: #0000BB">$fragment</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">&lt;hello/&gt;beautiful&lt;world/&gt;</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-domdocumentfragment.prepend-seealso">
  <h3 class="title">Voir aussi</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="domparentnode.prepend.php" class="methodname" rel="rdfs-seeAlso">DOMParentNode::prepend()</a> - Ajoute des n&oelig;uds avant le premier n&oelig;ud enfant</span></li>
   <li><span class="methodname"><a href="domdocumentfragment.append.php" class="methodname" rel="rdfs-seeAlso">DOMDocumentFragment::append()</a> - Ajoute des n&oelig;uds apr&egrave;s le dernier n&oelig;ud enfant</span></li>
  </ul>
 </div>


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