2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-08-18 16:18:48 +00:00
|
|
|
<!-- $Revision: 1.9 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/math.xml, last change in rev 1.16 -->
|
|
|
|
<refentry id="function.hexdec">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>hexdec</refname>
|
|
|
|
<refpurpose>Hexadecimal to decimal</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
2004-08-16 13:51:54 +00:00
|
|
|
<type>number</type><methodname>hexdec</methodname>
|
2002-04-15 00:12:54 +00:00
|
|
|
<methodparam><type>string</type><parameter>hex_string</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Returns the decimal equivalent of the hexadecimal number
|
2002-06-03 15:06:16 +00:00
|
|
|
represented by the <parameter>hex_string</parameter> argument.
|
|
|
|
<function>hexdec</function> converts a hexadecimal string to a
|
|
|
|
decimal number. The largest number that can be converted is
|
|
|
|
7fffffff or 2147483647 in decimal.
|
2004-08-18 16:18:48 +00:00
|
|
|
As of PHP 4.1.0, this function can also convert larger numbers. It returns
|
2004-08-16 13:51:54 +00:00
|
|
|
<type>float</type> in that case.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2004-02-26 14:03:13 +00:00
|
|
|
<function>hexdec</function> will ignore any non-hexadecimal
|
|
|
|
characters it encounters.
|
2002-04-15 00:12:54 +00:00
|
|
|
<example>
|
|
|
|
<title><function>hexdec</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
2003-06-16 18:31:33 +00:00
|
|
|
<?php
|
2002-04-15 00:12:54 +00:00
|
|
|
var_dump(hexdec("See"));
|
|
|
|
var_dump(hexdec("ee"));
|
2003-06-16 18:31:33 +00:00
|
|
|
// both print "int(238)"
|
2002-04-15 00:12:54 +00:00
|
|
|
|
2004-02-26 14:03:13 +00:00
|
|
|
var_dump(hexdec("that")); // print "int(10)"
|
|
|
|
var_dump(hexdec("a0")); // print "int(160)"
|
2003-06-16 18:31:33 +00:00
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
<para>
|
2003-12-08 09:19:12 +00:00
|
|
|
See also <function>dechex</function>,
|
|
|
|
<function>bindec</function>,
|
|
|
|
<function>octdec</function> and
|
|
|
|
<function>base_convert</function>.
|
2002-04-15 00:12:54 +00:00
|
|
|
</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:"../../../../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
|
|
|
|
-->
|