<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.xml.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.xml-set-processing-instruction-handler.php',
    1 => 'xml_set_processing_instruction_handler',
    2 => 'Set up processing instruction (PI) handler',
  ),
  'up' => 
  array (
    0 => 'ref.xml.php',
    1 => 'XML Parser Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.xml-set-object.php',
    1 => 'xml_set_object',
  ),
  'next' => 
  array (
    0 => 'function.xml-set-start-namespace-decl-handler.php',
    1 => 'xml_set_start_namespace_decl_handler',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/xml/functions/xml-set-processing-instruction-handler.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.xml-set-processing-instruction-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xml_set_processing_instruction_handler</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">xml_set_processing_instruction_handler</span> &mdash; <span class="dc-title">
   Set up processing instruction (PI) handler
  </span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.xml-set-processing-instruction-handler-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>xml_set_processing_instruction_handler</strong></span>(<span class="methodparam"><span class="type"><a href="class.xmlparser.php" class="type XMLParser">XMLParser</a></span> <code class="parameter">$parser</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$handler</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   Sets the processing instruction (PI) handler function for the XML parser
   <code class="parameter">parser</code>.
  </p>
  <p class="para">
   A processing instruction has the following format:
   <div class="example-contents">
<div class="annotation-interactive xmlcode"><pre class="xmlcode">&lt;?target
data
?&gt;</pre>
</div>
   </div>

  </p>
  <div class="caution"><strong class="caution">Achtung</strong>
   <p class="para">
    PHP code is delimited by the <code class="literal">&lt;?php</code>
    processing instruction.
    As such it is possible to have PHP code within an XML document.
    However, the PI end tag (<code class="literal">?&gt;</code>) must not be part of
    the data.
    If a PI end tag exists as part of the embedded PHP code,
    the rest of the PHP code and the &quot;real&quot; PI end tag, will be treated
    as character data.
   </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.xml-set-processing-instruction-handler-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
 <dt><code class="parameter">parser</code></dt>
 <dd>
  <p class="para">
   Der XML-Parser
  </p>
 </dd>

    
     <dt><code class="parameter">handler</code></dt>
     <dd>
      <p class="para">
 Wenn <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> übergeben wird, wird der Handler auf seinen Standardzustand
 zurückgesetzt.
 <div class="warning"><strong class="warning">Warnung</strong>
  <p class="simpara">
   Eine leere Zeichenkette setzt den Handler ebenfalls zurück, allerdings ist
   dies seit PHP 8.4.0 veraltet.
  </p>
 </div>
</p>
<p class="para">
 Wenn <code class="parameter">handler</code> vom Typ <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> ist, wird
 das Callable als Handler gesetzt.
</p>
<p class="para">
 Wenn <code class="parameter">handler</code> vom Typ <span class="type"><a href="language.types.string.php" class="type string">string</a></span> ist, kann es
 der Name der Methode eines Objekts sein, das mit
 <span class="function"><a href="function.xml-set-object.php" class="function">xml_set_object()</a></span> gesetzt wurde.
 <div class="warning"><strong class="warning">Warnung</strong>
  <p class="simpara">
   Dies ist seit PHP 8.4.0 veraltet.
  </p>
 </div>
</p>
<div class="warning"><strong class="warning">Warnung</strong>
 <p class="simpara">
  Seit PHP 8.4.0 wird die Gültigkeit des Callables bereits beim Setzen des
  Handlers geprüft, nicht erst beim Aufruf.
  Das bedeutet, dass <span class="function"><a href="function.xml-set-object.php" class="function">xml_set_object()</a></span> aufgerufen werden
  muss, bevor eine Methoden-Zeichenkette als Callback gesetzt wird.
  Da aber auch dieses Verhalten seit PHP 8.4.0 veraltet ist, wird stattdessen
  empfohlen, ein korrektes <span class="type"><a href="language.types.callable.php" class="type Callable">Callable</a></span> für die Methode zu verwenden.
 </p>
</div>

      <p class="para">
       The signature of the handler must be:
       <div class="methodsynopsis dc-description"><span class="methodname"><span class="replaceable">handler</span></span>(<span class="methodparam"><span class="type"><a href="class.xmlparser.php" class="type XMLParser">XMLParser</a></span> <code class="parameter">$parser</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$target</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$data</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

       <dl>
        
 <dt><code class="parameter">parser</code></dt>
 <dd>
  <span class="simpara">
   Der XML-Parser, der den Handler aufruft.
  </span>
 </dd>

        
         <dt><code class="parameter">target</code></dt>
         <dd>
          <span class="simpara">
           The processing instruction target.
          </span>
         </dd>
        
        
         <dt><code class="parameter">data</code></dt>
         <dd>
          <span class="simpara">
           The processing instruction data.
          </span>
         </dd>
        
       </dl>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xml-set-processing-instruction-handler-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt immer <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.xml-set-processing-instruction-handler-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.4.0</td>
 <td>
  Die Übergabe einer Zeichenkette an <code class="parameter">handler</code>, die kein
  <span class="type"><a href="language.types.callable.php" class="type Callable">Callable</a></span> ist, ist nun veraltet. Daher sollte für Methoden ein
  korrektes Callable verwendet werden, oder <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, um den Handler zurückzusetzen.
 </td>
</tr>

<tr>
 <td>8.4.0</td>
 <td>
  Die Gültigkeit von <code class="parameter">handler</code> als <span class="type"><a href="language.types.callable.php" class="type Callable">Callable</a></span>
  wird nun bereits beim Setzen des Handlers geprüft und nicht erst beim Aufruf.
 </td>
</tr>

     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">parser</code> erwartet nun eine
  <span class="classname"><a href="class.xmlparser.php" class="classname">XMLParser</a></span>-Instanz; vorher wurde eine gültige
  <code class="literal">xml</code>-<span class="type">Ressource</span> erwartet.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


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