<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.basic.vartype.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'book.ctype.php',
    1 => 'Ctype',
    2 => 'Character type checking',
  ),
  'up' => 
  array (
    0 => 'refs.basic.vartype.php',
    1 => 'Розширення для обробки змінних та типів',
  ),
  'prev' => 
  array (
    0 => 'function.trait-exists.php',
    1 => 'trait_exists',
  ),
  'next' => 
  array (
    0 => 'ctype.setup.php',
    1 => 'Встановлення/налаштування',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ctype/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.ctype.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.ctype" class="book">
 
 <h1 class="title">Character type checking</h1>
 

 <div id="intro.ctype" class="preface">
  <h1 class="title">Вступ</h1>
  <p class="para">
   The functions provided by this extension check whether a character
   or string falls into a certain character class according to the
   current locale (see also <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span>).
  </p>
  <p class="para">
   When called with an integer argument these functions
   behave exactly like their C counterparts from
   <var class="filename">ctype.h</var>.
   It means that if an integer smaller than 256 is passed, it will use the
   ASCII value of it to see if it fits in the specified range (digits are in
   0x30-0x39). If the number is between -128 and -1 inclusive then 256 will
   be added and the check will be done on that.
  </p>
  <div class="warning"><strong class="warning">Увага</strong><p class="para"> Починаючи з PHP 8.1.0,
параметр, що не є рядком — застарів. У майбутньому параметр вважатиметься
виключно рядком, а не кодом символу з ASCII. Залежно від наміченої поведінки,
параметр буде або приведено до <span class="type"><a href="language.types.string.php" class="type string">string</a></span>, або явно опрацьовано функцією
<span class="function"><a href="function.chr.php" class="function">chr()</a></span>.</p></div>
  <p class="para">
   When called with a string argument they will check
   every character in the string and will only return
   <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if every character in the string matches the
   requested criteria. Якщо викликано з порожнім рядком — результатом буде <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
  <p class="para">
   Passing anything else but a string or integer will
   return <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> immediately.
  </p>
  <p class="para">
   It should be noted that ctype functions are always preferred over
   regular expressions, and even to some equivalent <code class="literal">&quot;str_*&quot;</code> and <code class="literal">&quot;is_*&quot;</code> functions.
   This is because of the fact that ctype uses a native C library and thus
   processes significantly faster.
  </p>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    These functions are not related to the Python &quot;ctypes&quot; library at all.
    The extension name stems from the <var class="filename">ctype.h</var> C header
    file that their C equivalents are defined in.
   </p>
   <p class="para">
    This extension also predates Python &quot;ctypes&quot; so any confusion
    caused by this naming is hardly PHP&#039;s fault.
   </p>
  </p></blockquote>
 </div>

 








 









<ul class="chunklist chunklist_book"><li><a href="ctype.setup.php">Встановлення/налаштування</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="ctype.requirements.php">Вимоги</a></li><li><a href="ctype.installation.php">Встановлення</a></li></ul></li><li><a href="ref.ctype.php">Функції Ctype</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.ctype-alnum.php">ctype_alnum</a> — Check for alphanumeric character(s)</li><li><a href="function.ctype-alpha.php">ctype_alpha</a> — Check for alphabetic character(s)</li><li><a href="function.ctype-cntrl.php">ctype_cntrl</a> — Check for control character(s)</li><li><a href="function.ctype-digit.php">ctype_digit</a> — Check for numeric character(s)</li><li><a href="function.ctype-graph.php">ctype_graph</a> — Check for any printable character(s) except space</li><li><a href="function.ctype-lower.php">ctype_lower</a> — Check for lowercase character(s)</li><li><a href="function.ctype-print.php">ctype_print</a> — Check for printable character(s)</li><li><a href="function.ctype-punct.php">ctype_punct</a> — Check for any printable character which is not whitespace or an
   alphanumeric character</li><li><a href="function.ctype-space.php">ctype_space</a> — Check for whitespace character(s)</li><li><a href="function.ctype-upper.php">ctype_upper</a> — Check for uppercase character(s)</li><li><a href="function.ctype-xdigit.php">ctype_xdigit</a> — Check for character(s) representing a hexadecimal digit</li></ul></li></ul></div><?php manual_footer($setup); ?>