Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 4678

php-manual-en-7.2.11-1.mga7.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>Find position of first occurrence of string in a string</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-strlen.html">mb_strlen</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-strrchr.html">mb_strrchr</a></div>
 <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.mb-strpos" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_strpos</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">mb_strpos</span> &mdash; <span class="dc-title">Find position of first occurrence of string in a string</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-strpos-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>mb_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">$encoding</code><span class="initializer"> = mb_internal_encoding()</span></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Finds position of the first occurrence of a <span class="type"><a href="language.types.string.html" class="type string">string</a></span> in a <span class="type"><a href="language.types.string.html" class="type string">string</a></span>.
  </p>
  <p class="para">
   Performs a multi-byte safe
   <span class="function"><a href="function.strpos.html" class="function">strpos()</a></span> operation based on number of
   characters. The first character&#039;s position is 0, the second character
   position is 1, and so on. 
  </p>
 </div>


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

    
     <dt>
<code class="parameter">haystack</code></dt>

     <dd>

      <p class="para">
       The <span class="type"><a href="language.types.string.html" class="type string">string</a></span> being checked.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">needle</code></dt>

     <dd>

      <p class="para">
       The string to find in <code class="parameter">haystack</code>. In contrast
       with <span class="function"><a href="function.strpos.html" class="function">strpos()</a></span>, numeric values are not applied
       as the ordinal value of a character.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">offset</code></dt>

     <dd>

      <p class="para">
       The search offset. If it is not specified, 0 is used.
       A negative offset counts from the end of the string.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">encoding</code></dt>

     <dd>

      <p class="para">The <code class="parameter">encoding</code>
parameter is the character encoding. If it is omitted, the internal character
encoding value will be used.</p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-strpos-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the numeric position of
   the first occurrence of <code class="parameter">needle</code> in the
   <code class="parameter">haystack</code> <span class="type"><a href="language.types.string.html" class="type string">string</a></span>. If
   <code class="parameter">needle</code> is not found, it returns <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-strpos-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.1.0</td>
      <td>
       Support for negative <code class="parameter">offset</code>s has been added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-strpos-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.mb-internal-encoding.html" class="function" rel="rdfs-seeAlso">mb_internal_encoding()</a> - Set/Get internal character encoding</span></li>
    <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>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-strlen.html">mb_strlen</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-strrchr.html">mb_strrchr</a></div>
 <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>