<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Return Unicode code point value of character</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlchar.isxdigit.html">IntlChar::isxdigit</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlchar.tolower.html">IntlChar::tolower</a></div> <div class="up"><a href="class.intlchar.html">IntlChar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="intlchar.ord" class="refentry"> <div class="refnamediv"> <h1 class="refname">IntlChar::ord</h1> <p class="verinfo">(PHP 7)</p><p class="refpurpose"><span class="refname">IntlChar::ord</span> — <span class="dc-title">Return Unicode code point value of character</span></p> </div> <div class="refsect1 description" id="refsect1-intlchar.ord-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">int</span> <span class="methodname"><strong>IntlChar::ord</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$character</code></span> )</div> <p class="para rdfs-comment"> Returns the Unicode code point value of the given character. </p> <p class="para"> This function compliments <span class="function"><a href="intlchar.chr.html" class="function">IntlChar::chr()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-intlchar.ord-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">character</code></dt> <dd> <p class="para"> A Unicode character. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-intlchar.ord-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the Unicode code point value as an integer. </p> </div> <div class="refsect1 examples" id="refsect1-intlchar.ord-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-3246"> <p><strong>Example #1 Testing different code points</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlChar</span><span style="color: #007700">::</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #DD0000">"A"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlChar</span><span style="color: #007700">::</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #DD0000">" "</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlChar</span><span style="color: #007700">::</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #DD0000">"\u{2603}"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> int(65) int(32) int(9731) </pre></div> </div> </div> </div> <div class="refsect1 seealso" id="refsect1-intlchar.ord-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="intlchar.isalnum.html" class="function" rel="rdfs-seeAlso">IntlChar::isalnum()</a> - Check if code point is an alphanumeric character</span></li> <li class="member"><span class="function"><a href="intlchar.isdigit.html" class="function" rel="rdfs-seeAlso">IntlChar::isdigit()</a> - Check if code point is a digit character</span></li> <li class="member"><span class="function"><a href="intlchar.chr.html" class="function" rel="rdfs-seeAlso">IntlChar::chr()</a> - Return Unicode character by code point value</span></li> <li class="member"><span class="function"><a href="function.ord.html" class="function" rel="rdfs-seeAlso">ord()</a> - Convert the first byte of a string to a value between 0 and 255</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlchar.isxdigit.html">IntlChar::isxdigit</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlchar.tolower.html">IntlChar::tolower</a></div> <div class="up"><a href="class.intlchar.html">IntlChar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>