Movatterモバイル変換


[0]ホーム

URL:


PHP 8.5.0 Alpha 2 available for testing
    acos »
    « Math Functions

    abs

    (PHP 4, PHP 5, PHP 7, PHP 8)

    absAbsolute value

    Description

    abs(int|float$num):int|float

    Returns the absolute value ofnum.

    Parameters

    num

    The numeric value to process

    Return Values

    The absolute value ofnum. If the argumentnum is of typefloat, the return type is alsofloat, otherwise it isint (asfloat usually has a bigger value range thanint).

    Changelog

    VersionDescription
    8.0.0num no longer accepts internal objects which support numeric conversion.

    Examples

    Example #1abs() example

    <?php
    var_dump
    (abs(-4.2));
    var_dump(abs(5));
    var_dump(abs(-5));
    ?>

    The above example will output:

    float(4.2)int(5)int(5)

    See Also

    Found A Problem?

    Learn How To Improve This PageSubmit a Pull RequestReport a Bug
    add a note

    User Contributed Notes

    There are no user contributed notes for this page.
    To Top
    and to navigate •Enter to select •Esc to close
    PressEnter without selection to search using Google

    [8]ページ先頭

    ©2009-2025 Movatter.jp