<?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-stristr.php',
    1 => 'mb_stristr',
    2 => '大小写不敏感地查找字符串在另一个字符串里的首次出现',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => '多字节字符串 函数',
  ),
  'prev' => 
  array (
    0 => 'function.mb-stripos.php',
    1 => 'mb_stripos',
  ),
  'next' => 
  array (
    0 => 'function.mb-strlen.php',
    1 => 'mb_strlen',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mbstring/functions/mb-stristr.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-stristr" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_stristr</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_stristr</span> &mdash; <span class="dc-title">大小写不敏感地查找字符串在另一个字符串里的首次出现</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.mb-stristr-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_stristr</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.boolean.php" class="type bool">bool</a></span> <code class="parameter">$before_needle</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></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.string.php" class="type string">string</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.mb-strstr.php" class="function">mb_strstr()</a></span> 查找了 <code class="parameter">needle</code> 在 <code class="parameter">haystack</code> 中首次的出现并返回 <code class="parameter">haystack</code> 的一部分。
   和 <span class="function"><a href="function.mb-strstr.php" class="function">mb_strstr()</a></span> 不同的是，<span class="function"><strong>mb_stristr()</strong></span> 是大小写不敏感的。
   如果 <code class="parameter">needle</code> 没有找到，它将返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.mb-stristr-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> 首次出现的字符串。
      </p>
     </dd>
    
    
     <dt><code class="parameter">needle</code></dt>
     <dd>
      <p class="para">
       在 <code class="parameter">haystack</code> 中查找这个字符串。
      </p>
     </dd>
    
    
     <dt><code class="parameter">before_needle</code></dt>
     <dd>
      <p class="para">
       决定这个函数返回 <code class="parameter">haystack</code> 的哪一部分。
       如果设置为 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>，它返回 <code class="parameter">haystack</code> 中从开始到 <code class="parameter">needle</code> 出现位置的所有字符（不包括 needle）。
       如果设置为 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>，它返回 <code class="parameter">haystack</code> 中 <code class="parameter">needle</code> 出现位置到最后的所有字符（包括了 needle）。
      </p>
     </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-stristr-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 <code class="parameter">haystack</code> 的一部分，或者 <code class="parameter">needle</code> 没找到则返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 

 <div class="refsect1 changelog" id="refsect1-function.mb-stristr-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> 可以为 null。
  </td>
 </tr>

    </tbody>
   
  </table>

 </div>


 

 <div class="refsect1 seealso" id="refsect1-function.mb-stristr-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.stristr.php" class="function" rel="rdfs-seeAlso">stristr()</a> - strstr 函数的忽略大小写版本</span></li>
    <li><span class="function"><a href="function.strstr.php" class="function" rel="rdfs-seeAlso">strstr()</a> - 查找字符串的首次出现</span></li>
    <li><span class="function"><a href="function.mb-strstr.php" class="function" rel="rdfs-seeAlso">mb_strstr()</a> - 查找字符串在另一个字符串里的首次出现</span></li>
   </ul>
  </p>
 </div>

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