Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math log10() function returns the base-10 logarithm of a given number.

Syntax

log10(number)

Parameters

number Required. Specify the number.

Return Value

Returns the base-10 logarithm of a given number.

Example:

In the below example, log10() function is used to calculate the base-10 logarithm of a given number.

<?php
$x = 10; 
$y = 50;
$z = 100;

echo "log10($x) equal to: ".log10($x)."\n";
echo "log10($y) equal to: ".log10($y)."\n";
echo "log10($z) equal to: ".log10($z)."\n";  
?>

The output of the above code will be:

log10(10) equal to: 1
log10(50) equal to: 1.698970004336
log10(100) equal to: 2

❮ PHP Math Functions