Computer >> Computer tutorials >  >> Programming >> PHP

log10() function in PHP


The log10() function Return the base-10 logarithm of a number.

Syntax

log10(num)

Parameters

  • num − The value to calculate the logarithm for.

Return

The log10() function Returns base 10 logarithm of a number.

Example

<?php
   echo(log10(1));
?>

Output

0

Example

Let us see another example −

<?php
   echo(log10(0));
?>

Output

-INF

Example

Let us see another example −

<?php
   echo(log10(10));
   echo(log10(2.7));
?>

Output

10.43136376415899