<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.domxpath.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'domxpath.quote.php',
    1 => 'DOMXPath::quote',
    2 => 'Quotes a string for use in an XPath expression',
  ),
  'up' => 
  array (
    0 => 'class.domxpath.php',
    1 => 'DOMXPath',
  ),
  'prev' => 
  array (
    0 => 'domxpath.query.php',
    1 => 'DOMXPath::query',
  ),
  'next' => 
  array (
    0 => 'domxpath.registernamespace.php',
    1 => 'DOMXPath::registerNamespace',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/dom/domxpath/quote.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="domxpath.quote" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMXPath::quote</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.4.0)</p><p class="refpurpose"><span class="refname">DOMXPath::quote</span> &mdash; <span class="dc-title">
   Quotes a string for use in an XPath expression
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-domxpath.quote-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>DOMXPath::quote</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="simpara">
   Quotes <code class="parameter">str</code> for use in an XPath expression.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-domxpath.quote-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">str</code></dt>
     <dd>
      <span class="simpara">
       The string to quote.
      </span>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-domxpath.quote-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Returns a quoted string to be used in an XPath expression.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-domxpath.quote-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 Matching attribute value with quotes</strong></p>
   <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">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">loadXML</span><span style="color: #007700">(&lt;&lt;&lt;XML<br /></span><span style="color: #DD0000">&lt;books&gt;<br />    &lt;book name="'quoted' name"&gt;Book title&lt;/book&gt;<br />&lt;/books&gt;<br /></span><span style="color: #007700">XML);<br /><br /></span><span style="color: #0000BB">$xpath </span><span style="color: #007700">= new </span><span style="color: #0000BB">DOMXPath</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$query </span><span style="color: #007700">= </span><span style="color: #DD0000">"//book[@name=" </span><span style="color: #007700">. </span><span style="color: #0000BB">DOMXPath</span><span style="color: #007700">::</span><span style="color: #0000BB">quote</span><span style="color: #007700">(</span><span style="color: #DD0000">"'quoted' name"</span><span style="color: #007700">) . </span><span style="color: #DD0000">"]"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$query</span><span style="color: #007700">, </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$entries </span><span style="color: #007700">= </span><span style="color: #0000BB">$xpath</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">);<br /><br />foreach (</span><span style="color: #0000BB">$entries </span><span style="color: #007700">as </span><span style="color: #0000BB">$entry</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Found "</span><span style="color: #007700">, </span><span style="color: #0000BB">$entry</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">textContent</span><span style="color: #007700">, </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">//book[@name=&quot;&#039;quoted&#039; name&quot;]
Found Book title</pre>
</div>
   </div>
   <div class="example-contents"><p>
    Mixed quote types are also supported:
   </p></div>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">DOMXPath</span><span style="color: #007700">::</span><span style="color: #0000BB">quote</span><span style="color: #007700">(</span><span style="color: #DD0000">"'different' \"quote\" styles"</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 folgende Ausgabe:</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">concat(&quot;&#039;different&#039; &quot;,&#039;&quot;quote&quot; styles&#039;)</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-domxpath.quote-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="domxpath.evaluate.php" class="methodname" rel="rdfs-seeAlso">DOMXPath::evaluate()</a> - Evaluates the given XPath expression and returns a typed result if possible</span></li>
    <li><span class="methodname"><a href="domxpath.query.php" class="methodname" rel="rdfs-seeAlso">DOMXPath::query()</a> - Evaluates the given XPath expression</span></li>
   </ul>
  </p>
 </div>

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