2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 07:54:14 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.abs" xmlns="http://docbook.org/ns/docbook">
|
2007-03-31 10:43:52 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>abs</refname>
|
|
|
|
<refpurpose>Absolute value</refpurpose>
|
|
|
|
</refnamediv>
|
2007-03-31 11:20:55 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-03-31 10:43:52 +00:00
|
|
|
<methodsynopsis>
|
2020-12-23 23:40:46 +00:00
|
|
|
<type class="union"><type>int</type><type>float</type></type><methodname>abs</methodname>
|
|
|
|
<methodparam><type class="union"><type>int</type><type>float</type></type><parameter>num</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
2007-03-31 10:43:52 +00:00
|
|
|
<para>
|
2020-12-23 23:40:46 +00:00
|
|
|
Returns the absolute value of <parameter>num</parameter>.
|
2007-03-31 10:43:52 +00:00
|
|
|
</para>
|
2007-03-31 11:20:55 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2020-12-23 23:40:46 +00:00
|
|
|
<term><parameter>num</parameter></term>
|
2007-03-31 11:20:55 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The numeric value to process
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2020-12-23 23:40:46 +00:00
|
|
|
The absolute value of <parameter>num</parameter>. If the
|
|
|
|
argument <parameter>num</parameter> is
|
2007-03-31 19:18:23 +00:00
|
|
|
of type <type>float</type>, the return type is also <type>float</type>,
|
2020-11-02 15:39:04 +00:00
|
|
|
otherwise it is <type>int</type> (as <type>float</type> usually has a
|
|
|
|
bigger value range than <type>int</type>).
|
2007-03-31 11:20:55 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2020-12-23 23:40:46 +00:00
|
|
|
|
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>8.0.0</entry>
|
|
|
|
<entry>
|
|
|
|
<parameter>num</parameter> no longer accepts internal objects which support
|
|
|
|
numeric conversion.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-03-31 11:20:55 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>abs</function> example</title>
|
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
2003-06-16 18:31:33 +00:00
|
|
|
<?php
|
2014-06-04 08:23:01 +00:00
|
|
|
echo abs(-4.2); // 4.2 (double/float)
|
|
|
|
echo abs(5); // 5 (integer)
|
|
|
|
echo abs(-5); // 5 (integer)
|
2003-06-16 18:31:33 +00:00
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
2007-03-31 11:20:55 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-03-31 10:43:52 +00:00
|
|
|
</refsect1>
|
2010-04-06 22:50:21 +00:00
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>gmp_abs</function></member>
|
|
|
|
<member><function>gmp_sign</function></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-03-31 10:43:52 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|