php abs函数怎么用?

 

php abs函数怎么用?

abs()函数的作用是返回一个数的绝对值。语法是abs(number),如果参数 number 是 float,则返回的类型也是 float,否则返回 integer(因为 float 通常比 integer 有更大的取值范围)。

abs()函数作用:abs()函数的作用是返回一个数的绝对值。

语法:

 

 

参数:

number 必须,是一个数。

说明:返回参数的绝对值,如果参数是float,则返回的类型也是float,如果参数是int,返回类型是int,如果参数是string字符串,则返回0;

php abs()函数使用示例:

 

 输出:

  

以上就是php abs函数怎么用?的详细内容

猜你喜欢

转载自www.cnblogs.com/IT-SUJIU/p/11745454.html
今日推荐