<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.str-ends-with.php',
    1 => 'str_ends_with',
    2 => '文字列が、指定された文字列で終わるかを調べる。',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String 関数',
  ),
  'prev' => 
  array (
    0 => 'function.str-decrement.php',
    1 => 'str_decrement',
  ),
  'next' => 
  array (
    0 => 'function.str-getcsv.php',
    1 => 'str_getcsv',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/strings/functions/str-ends-with.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.str-ends-with" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">str_ends_with</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">str_ends_with</span> &mdash; <span class="dc-title">文字列が、指定された文字列で終わるかを調べる。</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.str-ends-with-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>str_ends_with</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$haystack</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$needle</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   <code class="parameter">haystack</code> が
   <code class="parameter">needle</code> で終わるかを調べます。
   大文字小文字は区別されます。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.str-ends-with-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">haystack</code></dt>
     <dd>
      <p class="para">
       検索対象の文字列。
      </p>
     </dd>
    
    
     <dt><code class="parameter">needle</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">haystack</code> で調べる部分文字列
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.str-ends-with-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.true">true</a></code></strong> を返します。
   そうでない場合、<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.str-ends-with-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 空文字列 <code class="literal">&#039;&#039;</code> を使う場合</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">str_ends_with</span><span style="color: #007700">(</span><span style="color: #DD0000">'abc'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">"All strings end with the empty string"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>上の例の出力は以下となります。</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">All strings end with the empty string</pre>
</div>
    </div>
   </div>

   <div class="example" id="example-2">
    <p><strong>例2 大文字小文字の区別</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$string </span><span style="color: #007700">= </span><span style="color: #DD0000">'The lazy fox jumped over the fence'</span><span style="color: #007700">;<br /><br />if (</span><span style="color: #0000BB">str_ends_with</span><span style="color: #007700">(</span><span style="color: #0000BB">$string</span><span style="color: #007700">, </span><span style="color: #DD0000">'fence'</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">"The string ends with 'fence'\n"</span><span style="color: #007700">;<br />}<br /><br />if (</span><span style="color: #0000BB">str_ends_with</span><span style="color: #007700">(</span><span style="color: #0000BB">$string</span><span style="color: #007700">, </span><span style="color: #DD0000">'Fence'</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">'The string ends with "Fence"'</span><span style="color: #007700">;<br />} else {<br />    echo </span><span style="color: #DD0000">'"Fence" was not found because the case does not match'</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>上の例の出力は以下となります。</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">The string ends with &#039;fence&#039;
&quot;Fence&quot; was not found because the case does not match</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.str-ends-with-notes">
  <h3 class="title">注意</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: <span class="simpara">この関数はバイナリデータに対応しています。
</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.str-ends-with-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.str-contains.php" class="function" rel="rdfs-seeAlso">str_contains()</a> - 指定された部分文字列が、文字列に含まれるかを調べる</span></li>
    <li><span class="function"><a href="function.str-starts-with.php" class="function" rel="rdfs-seeAlso">str_starts_with()</a> - 文字列が指定された部分文字列で始まるかを調べる</span></li>
    <li><span class="function"><a href="function.stripos.php" class="function" rel="rdfs-seeAlso">stripos()</a> - 大文字小文字を区別せずに文字列が最初に現れる位置を探す</span></li>
    <li><span class="function"><a href="function.strrpos.php" class="function" rel="rdfs-seeAlso">strrpos()</a> - 文字列中に、ある部分文字列が最後に現れる場所を探す</span></li>
    <li><span class="function"><a href="function.strripos.php" class="function" rel="rdfs-seeAlso">strripos()</a> - 文字列中で、特定の(大文字小文字を区別しない)文字列が最後に現れた位置を探す</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.strpbrk.php" class="function" rel="rdfs-seeAlso">strpbrk()</a> - 文字列の中から任意の文字を探す</span></li>
    <li><span class="function"><a href="function.substr.php" class="function" rel="rdfs-seeAlso">substr()</a> - 文字列の一部分を返す</span></li>
    <li><span class="function"><a href="function.preg-match.php" class="function" rel="rdfs-seeAlso">preg_match()</a> - 正規表現によるマッチングを行う</span></li>
   </ul>
  </p>
 </div>


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