Math Log10 In PHP

In this article I explain the PHP math log10 function.
  • 1649

PHP log10() function

The PHP math log function is used to return the base-10 logarithm of a number.

Syntax

log10( number)


Parameters in
 log10 function

It takes one parameter; it is:
 

Parameter Description
number It specifies a number.

Example of log10 function

<?php

$val1=log10(2);

$val2=log10(0);

$val3=log10(1.232);

$val4=log10(1);

echo "log10 value of <b>2</b> is <b>$val1</b> <br />";

echo "log10 value of <b>0</b> is <b>$val2</b> <br />";

echo "log10 value of <b>1.232</b> is <b>$val3</b> <br />";

echo "log10 value of <b>1</b> is <b>$val4</b> <br />";

?>

Note: The above code is used to convert numbers to the base-10 logarithm of a number. So in the above example the numbers "2", "0", "1.232" and "1" are converted to the base-10 logarithm of the number.

Output

log10-math-function-in-php.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.