Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 3560

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Finds position of first occurrence of a needle within a haystack</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.iconv-strlen.html">iconv_strlen</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.iconv-strrpos.html">iconv_strrpos</a></div>
 <div class="up"><a href="ref.iconv.html">iconv Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.iconv-strpos" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">iconv_strpos</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">iconv_strpos</span> &mdash; <span class="dc-title">Finds position of first occurrence of a needle within a haystack</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.iconv-strpos-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>iconv_strpos</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$haystack</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$needle</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code><span class="initializer"> = ini_get(&quot;iconv.internal_encoding&quot;)</span></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Finds position of first occurrence of a <em><code class="parameter">needle</code></em>
   within a <em><code class="parameter">haystack</code></em>.
  </p>
  <p class="para">
   In contrast to  <span class="function"><a href="function.strpos.html" class="function">strpos()</a></span>, the return value of
    <span class="function"><strong>iconv_strpos()</strong></span> is the number of characters that
   appear before the needle, rather than the offset in bytes to the
   position where the needle has been found. The characters are counted
   on the basis of the specified character set <em><code class="parameter">charset</code></em>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.iconv-strpos-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">haystack</code></em></span>
     <dd>

      <p class="para">
       The entire string.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">needle</code></em></span>
     <dd>

      <p class="para">
       The searched substring.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">offset</code></em></span>
     <dd>

      <p class="para">
       The optional <em><code class="parameter">offset</code></em> parameter specifies
       the position from which the search should be performed.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">charset</code></em></span>
     <dd>

      <p class="para">
       If <em><code class="parameter">charset</code></em> parameter is omitted,
       <em><code class="parameter">string</code></em> are assumed to be encoded in
       <a href="iconv.configuration.html" class="link">iconv.internal_encoding</a>.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
  <p class="para">
   If <em><code class="parameter">haystack</code></em> or <em><code class="parameter">needle</code></em> is
   not a string, it is converted to a string and applied as the ordinal
   value of a character.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.iconv-strpos-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the numeric position of the first occurrence of
   <em><code class="parameter">needle</code></em> in <em><code class="parameter">haystack</code></em>.
  </p>
  <p class="para">
   If <em><code class="parameter">needle</code></em> is not found,
    <span class="function"><strong>iconv_strpos()</strong></span> will return <strong><code>FALSE</code></strong>.
  </p>
  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function may
return Boolean <strong><code>FALSE</code></strong>, but may also return a non-Boolean value which
evaluates to <strong><code>FALSE</code></strong>. Please read the section on <a href="language.types.boolean.html" class="link">Booleans</a> for more
information. Use <a href="language.operators.comparison.html" class="link">the ===
operator</a> for testing the return value of this
function.</p></div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.iconv-strpos-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.strpos.html" class="function" rel="rdfs-seeAlso">strpos()</a> - Find the position of the first occurrence of a substring in a string</span></li>
    <li class="member"> <span class="function"><a href="function.iconv-strrpos.html" class="function" rel="rdfs-seeAlso">iconv_strrpos()</a> - Finds the last occurrence of a needle within a haystack</span></li>
    <li class="member"> <span class="function"><a href="function.mb-strpos.html" class="function" rel="rdfs-seeAlso">mb_strpos()</a> - Find position of first occurrence of string in a string</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.iconv-strlen.html">iconv_strlen</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.iconv-strrpos.html">iconv_strrpos</a></div>
 <div class="up"><a href="ref.iconv.html">iconv Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>