<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.ctype.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.ctype-xdigit.php',
    1 => 'ctype_xdigit',
    2 => '16 進数を表す文字かどうかを調べる',
  ),
  'up' => 
  array (
    0 => 'ref.ctype.php',
    1 => 'Ctype 関数',
  ),
  'prev' => 
  array (
    0 => 'function.ctype-upper.php',
    1 => 'ctype_upper',
  ),
  'next' => 
  array (
    0 => 'book.filter.php',
    1 => 'フィルタ',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/ctype/functions/ctype-xdigit.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ctype-xdigit" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ctype_xdigit</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ctype_xdigit</span> &mdash; <span class="dc-title">
   16 進数を表す文字かどうかを調べる
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ctype-xdigit-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ctype_xdigit</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$text</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">text</code> のすべての文字が
   16 進の &#039;数字&#039; であるかどうかを調べます。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ctype-xdigit-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">text</code></dt>
     <dd>
      <p class="para">
       調べる文字列。
       <blockquote class="note"><p><strong class="note">注意</strong>: <p class="para">
-128 から 255 までの <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> を渡すと、ひとつの文字の ASCII 値とみなします
(負の値には 256 を足して、拡張 ASCII の範囲に収まるようにします)。
それ以外の整数値は、10 進数を含む文字列とみなします。</p></p></blockquote>
       <div class="warning"><strong class="warning">警告</strong><p class="para">
PHP 8.1.0 以降は、ctype関数 に文字列でない引数を渡すことは、推奨されなくなりました。将来のバージョンでは、引数は ASCII コードポイントではなく、文字列として解釈されるようになります。ユーザが意図する振る舞いによっては、引数を文字列にキャストするか、 <span class="function"><a href="function.chr.php" class="function">chr()</a></span> を明示的にコールすべきです。</p></div>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ctype-xdigit-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   <code class="parameter">text</code> のすべての文字が 16 進の &#039;数字&#039;
   つまり 10 進の数字または <code class="literal">[A-Fa-f]</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> を返します。
   空文字列を渡して呼び出した場合、結果は常に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> になります。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ctype-xdigit-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>ctype_xdigit()</strong></span> の例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$strings </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'AB10BC99'</span><span style="color: #007700">, </span><span style="color: #DD0000">'AR1012'</span><span style="color: #007700">, </span><span style="color: #DD0000">'ab12bc99'</span><span style="color: #007700">);<br />foreach (</span><span style="color: #0000BB">$strings </span><span style="color: #007700">as </span><span style="color: #0000BB">$testcase</span><span style="color: #007700">) {<br />    if (</span><span style="color: #0000BB">ctype_xdigit</span><span style="color: #007700">(</span><span style="color: #0000BB">$testcase</span><span style="color: #007700">)) {<br />        echo </span><span style="color: #DD0000">"The string </span><span style="color: #0000BB">$testcase</span><span style="color: #DD0000"> consists of all hexadecimal digits.\n"</span><span style="color: #007700">;<br />    } else {<br />        echo </span><span style="color: #DD0000">"The string </span><span style="color: #0000BB">$testcase</span><span style="color: #DD0000"> does not consist of all hexadecimal digits.\n"</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="examplescode"><pre class="examplescode">The string AB10BC99 consists of all hexadecimal digits.
The string AR1012 does not consist of all hexadecimal digits.
The string ab12bc99 consists of all hexadecimal digits.</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ctype-xdigit-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.ctype-digit.php" class="function" rel="rdfs-seeAlso">ctype_digit()</a> - 数字かどうかを調べる</span></li>
    <li><span class="function"><a href="intlchar.isxdigit.php" class="function" rel="rdfs-seeAlso">IntlChar::isxdigit()</a> - コードポイントが、16進数の文字であるかを調べる</span></li>
   </ul>
  </p>
 </div>

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