PHP Tutorial - PHP log10() Function






Definition

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

Syntax

PHP log10() Function has the following syntax.

log10(number);

Parameter

ParameterIs Required Description
numberRequired.Value to calculate the logarithm for

Return

Item Description
Return Value The base-10 logarithm of number
Return Type Float




Example

Return the base-10 logarithm of different numbers:


<?php
echo(log10(2.7183) . "\n");
echo(log10(2) . "\n");
echo(log10(10) . "\n");
echo(log10(0));
?>

The code above generates the following result.