[doc-en] master: IntlChar::digit: add literal tags, amend example (#3595)

From: Date: Fri, 15 May 2026 17:26:08 +0000
Subject: [doc-en] master: IntlChar::digit: add literal tags, amend example (#3595)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23312@lists.php.net to get a copy of this message
Author: Mikhail Alferov (mmalferov) Committer: GitHub (web-flow) Pusher: jordikroon Date: 2026-05-15T19:26:05+02:00 Commit: https://github.com/php/doc-en/commit/e166139c786f6fd72a5f856c14027a3c22a8ce7a Raw diff: https://github.com/php/doc-en/commit/e166139c786f6fd72a5f856c14027a3c22a8ce7a.diff IntlChar::digit: add literal tags, amend example (#3595) * digit.xml: add tags, amend example, del meaningless sentences > In this case the value is c-'A'+10 for latin lettera A-Z and > In this case the value is ch-'a'+10 — it looks like this text was copied aimlessly from the comment of the ICU source code file: https://github.com/unicode-org/icu/blob/40b2ec3c3727bca975824fdb9d1f084207d535ff/icu4c/source/common/unicode/uchar.h#L4252 And these sentences, IMHO, do not make sense in the context of the PHP method description, but only u_digit definition: https://github.com/unicode-org/icu/blob/40b2ec3c3727bca975824fdb9d1f084207d535ff/icu4c/source/common/uchar.cpp#L452 * digit.xml: restore ch - 'A' + 10 but replace ch to codepoint Changed paths: M reference/intl/intlchar/digit.xml Diff: diff --git a/reference/intl/intlchar/digit.xml b/reference/intl/intlchar/digit.xml index ea639d172a9e..a1793e0c8970 100644 --- a/reference/intl/intlchar/digit.xml +++ b/reference/intl/intlchar/digit.xml @@ -17,14 +17,32 @@ Returns the decimal digit value of the code point in the specified radix. </para> <para> - If the radix is not in the range <literal>2&lt;=radix&lt;=36</literal> or if the value of <parameter>codepoint</parameter> + If the radix is not in the range <literal>2 &lt;= radix &lt;= 36</literal> or + if the value of <parameter>codepoint</parameter> is not a valid digit in the specified radix, &false; is returned. A character is a valid digit if at least one of the following is true: <simplelist> - <member>The character has a decimal digit value. Such characters have the general category "Nd" (decimal digit numbers) and a Numeric_Type of Decimal. In this case the value is the character's decimal digit value.</member> - <member>The character is one of the uppercase Latin letters 'A' through 'Z'. In this case the value is c-'A'+10.</member> - <member>The character is one of the lowercase Latin letters 'a' through 'z'. In this case the value is ch-'a'+10.</member> - <member>Latin letters from both the ASCII range (0061..007A, 0041..005A) as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A) are recognized.</member> + <member> + The character has a decimal digit value. Such characters have the + general category "Nd" (decimal digit numbers) and a Numeric_Type of "Decimal". + In this case the value is the character's decimal digit value. + </member> + <member> + The character is one of the uppercase + Latin letters <literal>'A'</literal> through <literal>'Z'</literal>. + In this case the value is <literal>codepoint - 'A' + 10</literal>. + </member> + <member> + The character is one of the lowercase + Latin letters <literal>'a'</literal> through <literal>'z'</literal>. + In this case the value is <literal>codepoint - 'a' + 10</literal>. + </member> + <member> + Latin letters from both the ASCII range (<literal>0061..007A</literal>, + <literal>0041..005A</literal>) as well as + from the Fullwidth ASCII range (<literal>FF41..FF5A</literal>, + <literal>FF21..FF3A</literal>) are recognized. + </member> </simplelist> </para> </refsect1> @@ -65,10 +83,13 @@ <programlisting role="php"> <![CDATA[ <?php + var_dump(IntlChar::digit("0")); var_dump(IntlChar::digit("3")); -var_dump(IntlChar::digit("A")); + var_dump(IntlChar::digit("A", 16)); +var_dump(IntlChar::digit("A")); + ?> ]]> </programlisting>

« previous php.doc.cvs (#23312) next »