<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.eventbuffer.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'eventbuffer.search.php',
    1 => 'EventBuffer::search',
    2 => 'Scans the buffer for an occurrence of a string',
  ),
  'up' => 
  array (
    0 => 'class.eventbuffer.php',
    1 => 'EventBuffer',
  ),
  'prev' => 
  array (
    0 => 'eventbuffer.readline.php',
    1 => 'EventBuffer::readLine',
  ),
  'next' => 
  array (
    0 => 'eventbuffer.searcheol.php',
    1 => 'EventBuffer::searchEol',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/event/eventbuffer/search.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="eventbuffer.search" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">EventBuffer::search</h1>
  <p class="verinfo">(PECL event &gt;= 1.2.6-beta)</p><p class="refpurpose"><span class="refname">EventBuffer::search</span> &mdash; <span class="dc-title">Scans the buffer for an occurrence of a string</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-eventbuffer.search-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><strong>EventBuffer::search</strong></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$what</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code>
    <span class="initializer"> = -1</span>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$end</code>
    <span class="initializer"> = -1</span>
   </span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
   Scans the buffer for an occurrence of the string
   <code class="parameter">what</code>.
   It returns numeric position of the string, or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if the string was
   not found.
  </p>
  <p class="para">
   If the
   <code class="parameter">start</code>
   argument is provided, it points to the position at which the search should
   begin; otherwise, the search is performed from the start of the string. If
   <code class="parameter">end</code>
   argument provided, the search is performed between start and end buffer
   positions.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-eventbuffer.search-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt>
     <code class="parameter">what</code>
    </dt>
    <dd>
     <p class="para">
      String to search.
     </p>
    </dd>
   
   
    <dt>
     <code class="parameter">start</code>
    </dt>
    <dd>
     <p class="para">
      Start search position.
     </p>
    </dd>
   
   
    <dt>
     <code class="parameter">end</code>
    </dt>
    <dd>
     <p class="para">
      End search position.
     </p>
    </dd>
   
  </dl>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-eventbuffer.search-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Returns numeric position of the first occurrence of the string in the
   buffer, or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if string is not found.
  </p>
  <div class="warning"><strong class="warning">Warnung</strong><p class="simpara">Diese Funktion kann sowohl das
boolsche <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückliefern, als auch einen nicht-boolschen Wert, welcher zu <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> ausgewertet wird.
Weitere Informationen entnehmen Sie bitte dem Abschnitt über die
<a href="language.types.boolean.php" class="link"> boolschen Typen</a>. Benutzen Sie deshalb
<a href="language.operators.comparison.php" class="link">den === Operator</a>,
um den Rückgabewert dieser Funktion zu überprüfen.</p></div>
 </div>

 <div class="refsect1 examples" id="refsect1-eventbuffer.search-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 
    <span class="function"><strong>EventBuffer::search()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Count total occurrences of 'str' in 'buf'<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">count_instances</span><span style="color: #007700">(</span><span style="color: #0000BB">$buf</span><span style="color: #007700">, </span><span style="color: #0000BB">$str</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">$total </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$p     </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$i     </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />    while (</span><span style="color: #0000BB">1</span><span style="color: #007700">) {<br />        </span><span style="color: #0000BB">$p </span><span style="color: #007700">= </span><span style="color: #0000BB">$buf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">search</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">, </span><span style="color: #0000BB">$p</span><span style="color: #007700">);<br />        if (</span><span style="color: #0000BB">$p </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">) {<br />            break;<br />        }<br />        ++</span><span style="color: #0000BB">$total</span><span style="color: #007700">;<br />        ++</span><span style="color: #0000BB">$p</span><span style="color: #007700">;<br />    }<br /><br />    return </span><span style="color: #0000BB">$total</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$buf </span><span style="color: #007700">= new </span><span style="color: #0000BB">EventBuffer</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$buf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #DD0000">"Some string within a string inside another string"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">count_instances</span><span style="color: #007700">(</span><span style="color: #0000BB">$buf</span><span style="color: #007700">, </span><span style="color: #DD0000">"str"</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">int(3)</pre>
</div>
   </div>
  </div>
 </div>

 <div class="refsect1 seealso" id="refsect1-eventbuffer.search-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li>
    <span class="methodname"><a href="eventbuffer.searcheol.php" class="methodname" rel="rdfs-seeAlso">EventBuffer::searchEol()</a> - Scans the buffer for an occurrence of an end of line</span>
   </li>
  </ul>
 </div>

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