PHP log10() 函数

PHP log10() 函数

log10() 函数是预定义的 PHP 数学函数。它用于返回一个数的以10为底的对数。

语法

 log10(num);
参数 描述 必填/可选
num 指定要计算对数的值。 必填

注:num是一个以固定10进制为基础的输入数字。

示例1

<?php
num=5;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log($num);
?>

输出:

Your number is: 5
By using log10() function your number is : 1.6094379124341

示例2

<?php
num=1.234;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log($num);
?>

输出:

Your number is: 1.234
By using log10() function your number is : 0.2102609254832

示例3

<?php
num=1;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log($num);
?>

输出:

Your number is: 1
By using log10() function your number is : 0

示例4

<?php
num=0;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log($num);
?>

输出:

Your number is: 0
By using log10() function your number is : -INF

示例5

<?php
num=-1;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log($num);
?>

输出:

Your number is: -1
By using log10() function your number is : NAN

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程