Home >>PHP Math Functions >PHP log10() Function

PHP log10() Function

PHP log10() Function

PHP log10() function calculates the base-10 logarithm of the given input number. It accepts only a single parameter $number which is the number whose logarithm is to be calculated. It returns the result of the Base 10 logarithmic operation.

Syntax:

  log10($number);

Parameter Values

Parameter Description
number This is a required parameter. This parameter defines the value to calculate the logarithm for.

Here is an example of log10() function in PHP:

<html>
<body>

<?php

echo log10(0)."<br>";
echo log10(1)."<br>";
echo log10(10)."<br>";
echo log10(100)."<br>";

?>

</body>
</html>
Output:
-INF
0
1
2

Here is an another example of log10() function in PHP:

Here is an another example of log10() function in PHP:
<html>
<body>

<?php

echo log(10,10)."<br>";
echo log10(10)."<br>";
echo log(20,10)."<br>";
echo log10(20)."<br>";
echo log(100,10)."<br>";
echo log10(100)."<br>";
echo log(300,10)."<br>";
echo log10(300)."<br>";

?>

</body>
</html>
Output:
1
1
1.301029995664
1.301029995664
2
2
2.4771212547197
2.4771212547197