<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.mb-strrpos.php',
    1 => 'mb_strrpos',
    2 => '查找字符串在一个字符串中最后出现的位置',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => '多字节字符串 函数',
  ),
  'prev' => 
  array (
    0 => 'function.mb-strripos.php',
    1 => 'mb_strripos',
  ),
  'next' => 
  array (
    0 => 'function.mb-strstr.php',
    1 => 'mb_strstr',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mbstring/functions/mb-strrpos.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-strrpos" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_strrpos</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_strrpos</span> &mdash; <span class="dc-title">查找字符串在一个字符串中最后出现的位置</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mb-strrpos-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_strrpos</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$haystack</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$needle</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$offset</code><span class="initializer"> = 0</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   基于字符数执行一个多字节安全的 <span class="function"><a href="function.strrpos.php" class="function">strrpos()</a></span> 操作。
   <code class="parameter">needle</code> 的位置是从 <code class="parameter">haystack</code> 的开始进行统计的。
   第一个字符的位置是 0，第二个字符的位置是 1。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-strrpos-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">haystack</code></dt>
     <dd>
      <p class="para">
       查找 <code class="parameter">needle</code> 在这个 <span class="type"><a href="language.types.string.php" class="type string">string</a></span> 中最后出现的位置。
      </p>
     </dd>
    
    
     <dt><code class="parameter">needle</code></dt>
     <dd>
      <p class="para">
        在 <code class="parameter">haystack</code> 中查找这个 <span class="type"><a href="language.types.string.php" class="type string">string</a></span>。
      </p>
     </dd>
    
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <span class="simpara">
       可以指定从 <code class="parameter">haystack</code> 的任意字符位置开始搜索。负值将在 <code class="parameter">haystack</code> 结尾前的某个点停止搜索。
      </span>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para"><code class="parameter">encoding</code>
参数为字符编码。如果省略或是 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>，则使用内部字符编码。</p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-strrpos-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 <span class="type"><a href="language.types.string.php" class="type string">string</a></span> 的 <code class="parameter">haystack</code> 中，<code class="parameter">needle</code> 最后出现位置的数值。
   如果没有找到 <code class="parameter">needle</code>，它将返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.mb-strrpos-errors">
  <h3 class="title">错误／异常</h3>
  <ul class="itemizedlist">
  <li class="listitem">
   <span class="simpara">
    If <code class="parameter">offset</code> is greater than the length of
    <code class="parameter">haystack</code>, a
    <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> will be thrown.
   </span>
  </li>
 </ul>
</div>


 <div class="refsect1 changelog" id="refsect1-function.mb-strrpos-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.0.0</td>
 <td>
  现在 <code class="parameter">needle</code> 接受空字符串。
 </td>
</tr>

     <tr>
      <td>8.0.0</td>
      <td>
       已经删除将 <code class="parameter">encoding</code> 作为第三个参数而不是 <code class="parameter">offset</code> 传递。
      </td>
     </tr>

     <tr>
  <td>8.0.0</td>
  <td>
   现在 <code class="parameter">encoding</code> 可以为 null。
  </td>
 </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-strrpos-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-strpos.php" class="function" rel="rdfs-seeAlso">mb_strpos()</a> - 查找字符串在另一个字符串中首次出现的位置</span></li>
    <li><span class="function"><a href="function.mb-internal-encoding.php" class="function" rel="rdfs-seeAlso">mb_internal_encoding()</a> - 设置/获取内部字符编码</span></li>
    <li><span class="function"><a href="function.strrpos.php" class="function" rel="rdfs-seeAlso">strrpos()</a> - 计算指定字符串在目标字符串中最后一次出现的位置</span></li>
   </ul>
  </p>
 </div>


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