<?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.strnatcasecmp.php',
    1 => 'strnatcasecmp',
    2 => '&quot;自然順&quot;アルゴリズムにより大文字小文字を区別しない文字列比較を行う',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String 関数',
  ),
  'prev' => 
  array (
    0 => 'function.strlen.php',
    1 => 'strlen',
  ),
  'next' => 
  array (
    0 => 'function.strnatcmp.php',
    1 => 'strnatcmp',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/strings/functions/strnatcasecmp.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strnatcasecmp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">strnatcasecmp</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strnatcasecmp</span> &mdash; <span class="dc-title">&quot;自然順&quot;アルゴリズムにより大文字小文字を区別しない文字列比較を行う</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.strnatcasecmp-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>strnatcasecmp</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string1</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string2</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   この関数は、人間が行うような手法でアルファベットまたは数字の
   文字列の順序を比較するアルゴリズムを実装します。この関数の動作は、
   <span class="function"><a href="function.strnatcmp.php" class="function">strnatcmp()</a></span> に似ていますが、
   比較が大文字小文字を区別しない違いがあります。
   詳細な情報については、Martin Pool の
   <a href="https://github.com/sourcefrog/natsort" class="link external">&raquo;&nbsp;自然順文字列比較</a>
   のページを参照ください。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.strnatcasecmp-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string1</code></dt>
     <dd>
      <p class="para">
       最初の文字列。
      </p>
     </dd>
    
    
     <dt><code class="parameter">string2</code></dt>
     <dd>
      <p class="para">
       次の文字列。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.strnatcasecmp-returnvalues">
  <h3 class="title">戻り値</h3>
  
  <p class="simpara">
   <code class="parameter">string1</code> が <code class="parameter">string2</code> より小さければ 0 より小さな値を、
   <code class="parameter">string1</code> が <code class="parameter">string2</code> より大きければ 0 より大きな値を、
   両者が等しければ <code class="literal">0</code> を返します。
   返却される値の絶対値に、特に意味はありません。
  </p>

 </div>


 <div class="refsect1 changelog" id="refsect1-function.strnatcasecmp-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.2.0</td>
 <td>
  この関数は、2つの文字列の長さが等しくない場合に
  <code class="code">strlen($string1) - strlen($string2)</code> を返すとは限らなくなりました。
  代わりに、<code class="literal">-1</code> や <code class="literal">1</code> を返す可能性があります。
 </td>
</tr>


    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.strnatcasecmp-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>strnatcasecmp()</strong></span> の例</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">strnatcasecmp</span><span style="color: #007700">(</span><span style="color: #DD0000">'Apple'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Banana'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">strnatcasecmp</span><span style="color: #007700">(</span><span style="color: #DD0000">'Banana'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Apple'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">strnatcasecmp</span><span style="color: #007700">(</span><span style="color: #DD0000">'apple'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Apple'</span><span style="color: #007700">));<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">int(-1)
int(1)
int(0)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.strnatcasecmp-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.preg-match.php" class="function" rel="rdfs-seeAlso">preg_match()</a> - 正規表現によるマッチングを行う</span></li>
    <li><span class="function"><a href="function.strcmp.php" class="function" rel="rdfs-seeAlso">strcmp()</a> - バイナリセーフな文字列比較</span></li>
    <li><span class="function"><a href="function.strcasecmp.php" class="function" rel="rdfs-seeAlso">strcasecmp()</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.stristr.php" class="function" rel="rdfs-seeAlso">stristr()</a> - 大文字小文字を区別しない strstr</span></li>
    <li><span class="function"><a href="function.strncasecmp.php" class="function" rel="rdfs-seeAlso">strncasecmp()</a> - バイナリセーフで大文字小文字を区別しない文字列比較を、最初の n 文字について行う</span></li>
    <li><span class="function"><a href="function.strncmp.php" class="function" rel="rdfs-seeAlso">strncmp()</a> - 最初の n 文字についてバイナリセーフな文字列比較を行う</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.setlocale.php" class="function" rel="rdfs-seeAlso">setlocale()</a> - ロケール情報を設定する</span></li>
   </ul>
  </p>
 </div>


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