<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.mb-strstr.php',
    1 => 'mb_strstr',
    2 => '文字列の中で、指定した文字列が最初に現れる位置を見つける',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'マルチバイト文字列 関数',
  ),
  'prev' => 
  array (
    0 => 'function.mb-strrpos.php',
    1 => 'mb_strrpos',
  ),
  'next' => 
  array (
    0 => 'function.mb-strtolower.php',
    1 => 'mb_strtolower',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/mbstring/functions/mb-strstr.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-strstr" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_strstr</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_strstr</span> &mdash; <span class="dc-title">文字列の中で、指定した文字列が最初に現れる位置を見つける</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.mb-strstr-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_strstr</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"><strong>mb_strstr()</strong></span> は、
   <code class="parameter">haystack</code> の中で最初に
   <code class="parameter">needle</code> が現れる場所を探し、
   <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 parameters" id="refsect1-function.mb-strstr-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">needle</code> が最初に現れる位置から
       <code class="parameter">haystack</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-strstr-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-strstr-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> は、nullable になりました。
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 

 <div class="refsect1 seealso" id="refsect1-function.mb-strstr-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-stristr.php" class="function" rel="rdfs-seeAlso">mb_stristr()</a> - 大文字小文字を区別せず、
   文字列の中で指定した文字列が最初に現れる位置を探す</span></li>
   </ul>
  </p>
 </div>

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