GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Downloads
  • Documentation
  • Get Involved
  • Help
  • Getting Started
  • Introduction
  • A simple tutorial
  • Language Reference
  • Basic syntax
  • Types
  • Variables
  • Constants
  • Expressions
  • Operators

This view

  • Original page
  • New address

GeezerVison is showing www.php.net — PHP: log - Manual

PHP 8.6.0 RC5 available for testing
    log10 »
    « is_nan
    • Preface
    • Function Reference
    • Mathematical Extensions
    • Math
    • Math Functions

    log

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

    log — Natural logarithm

    Description

    function log(float $num, float $base = M_E): float

    If the optional base parameter is specified, log() returns logbase num, otherwise log() returns the natural logarithm of num.

    Parameters

    num

    The value to calculate the logarithm for

    base

    The optional logarithmic base to use (defaults to 'e' and so to the natural logarithm).

    Return Values

    The logarithm of num to base, if given, or the natural logarithm.

    Errors/Exceptions

    Throws a ValueError if base is less than or equal to 0.

    Changelog

    Version Description
    8.0.0 Now throws a ValueError if base is less than or equal to 0. Previously, an E_WARNING was raised and false was returned.

    See Also

    • log10() - Base-10 logarithm
    • exp() - Calculates the exponent of e
    • pow() - Exponential expression
    • error_log() - Send an error message to the defined error handling routines

    Found A Problem?

    Learn How To Improve This Page • Submit a Pull Request • Report a Bug
    +add a note

    User Contributed Notes

    There are no user contributed notes for this page.
    • Math Functions
      • abs
      • acos
      • acosh
      • asin
      • asinh
      • atan
      • atan2
      • atanh
      • base_​convert
      • bindec
      • ceil
      • clamp
      • cos
      • cosh
      • decbin
      • dechex
      • decoct
      • deg2rad
      • exp
      • expm1
      • fdiv
      • floor
      • fmod
      • fpow
      • hexdec
      • hypot
      • intdiv
      • is_​finite
      • is_​infinite
      • is_​nan
      • log
      • log10
      • log1p
      • max
      • min
      • octdec
      • pi
      • pow
      • rad2deg
      • round
      • sin
      • sinh
      • sqrt
      • tan
      • tanh
    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.