<?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 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.ctype-alpha.php',
    1 => 'ctype_alpha',
    2 => 'Check for alphabetic character(s)',
  ),
  'up' => 
  array (
    0 => 'ref.ctype.php',
    1 => 'Ctype Functions',
  ),
  'prev' => 
  array (
    0 => 'function.ctype-alnum.php',
    1 => 'ctype_alnum',
  ),
  'next' => 
  array (
    0 => 'function.ctype-cntrl.php',
    1 => 'ctype_cntrl',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ctype/functions/ctype-alpha.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ctype-alpha" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ctype_alpha</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ctype_alpha</span> &mdash; <span class="dc-title">Check for alphabetic character(s)</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ctype-alpha-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ctype_alpha</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">
   Checks if all of the characters in the provided <span class="type"><a href="language.types.string.php" class="type string">string</a></span>,
   <code class="parameter">text</code>, are alphabetic.
   In the standard <code class="literal">C</code> locale letters are just 
   <code class="literal">[A-Za-z]</code> and <span class="function"><strong>ctype_alpha()</strong></span> is 
   equivalent to <code class="literal">(ctype_upper($text) || ctype_lower($text))</code>
   if $text is just a single character, but other languages have letters that 
   are considered neither upper nor lower case.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ctype-alpha-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">text</code></dt>
     <dd>
      <p class="para">
       The tested string.
       <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">
If an <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> between -128 and 255 inclusive is provided, it is interpreted as
the ASCII value of a single character (negative values have 256 added in order to allow
characters in the Extended ASCII range). Any other integer is interpreted as a string
containing the decimal digits of the integer.</p></p></blockquote>
       <div class="warning"><strong class="warning">Warning</strong><p class="para">
As of PHP 8.1.0, passing a non-string argument is deprecated.
In the future, the argument will be interpreted as a string instead of an ASCII codepoint.
Depending on the intended behavior, the argument should either be cast to <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
or an explicit call to <span class="function"><a href="function.chr.php" class="function">chr()</a></span> should be made.</p></div>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ctype-alpha-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if every character in <code class="parameter">text</code> is 
   a letter from the current locale, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> otherwise.
   When called with an empty string the result will always be <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ctype-alpha-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 A <span class="function"><strong>ctype_alpha()</strong></span> example (using the default locale)</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">'KjgWZC'</span><span style="color: #007700">, </span><span style="color: #DD0000">'arf12'</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_alpha</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 letters.\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 letters.\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>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">The string KjgWZC consists of all letters.
The string arf12 does not consist of all letters.</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ctype-alpha-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.ctype-upper.php" class="function" rel="rdfs-seeAlso">ctype_upper()</a> - Check for uppercase character(s)</span></li>
    <li><span class="function"><a href="function.ctype-lower.php" class="function" rel="rdfs-seeAlso">ctype_lower()</a> - Check for lowercase character(s)</span></li>
    <li><span class="function"><a href="function.setlocale.php" class="function" rel="rdfs-seeAlso">setlocale()</a> - Set locale information</span></li>
    <li><span class="function"><a href="intlchar.isalpha.php" class="function" rel="rdfs-seeAlso">IntlChar::isalpha()</a> - Check if code point is a letter character</span></li>
   </ul>
  </p>
 </div>

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