mirror of
https://github.com/php/doc-zh.git
synced 2026-03-29 18:42:13 +02:00
139 lines
3.6 KiB
XML
139 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 761d72245071f89a626903c9bcdc6aaff1252d54 Maintainer: dallas Status: ready -->
|
|
<!-- CREDITS: mowangjuanzi, Luffy -->
|
|
<refentry xml:id="function.hexdec" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>hexdec</refname>
|
|
<refpurpose>十六进制转换为十进制</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>int</type><type>float</type></type><methodname>hexdec</methodname>
|
|
<methodparam><type>string</type><parameter>hex_string</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
返回与 <parameter>hex_string</parameter>
|
|
参数所表示的十六进制数等值的的十进制数。<function>hexdec</function>
|
|
将一个十六进制字符串转换为十进制数。
|
|
</para>
|
|
<para>
|
|
<function>hexdec</function> 会忽略它遇到的任意非十六进制的字符。自 PHP 7.4.0 起,弃用使用任何无效字符。
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>hex_string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
要转换的十六进制的字符串
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<parameter>hex_string</parameter> 十进制的表示
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>7.4.0</entry>
|
|
<entry>
|
|
传递任何无效字符现在将生成弃用通知。但仍会计算结果,就好像无效字符不存在一样。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>hexdec</function> 示例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
var_dump(hexdec("ee")); // prints "int(238)"
|
|
var_dump(hexdec("a0")); // prints "int(160)"
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>hexdec</function> 包含无效字符</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
var_dump(hexdec("See")); // print "int(238)"
|
|
var_dump(hexdec("that")); // print "int(10)"
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
此函数可以将太大的数字转换为适应平台的 <type>int</type> 类型,在这种情况下,较大值将会作为
|
|
<type>float</type> 返回。
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>dechex</function></member>
|
|
<member><function>bindec</function></member>
|
|
<member><function>octdec</function></member>
|
|
<member><function>base_convert</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|