PHP中的float类型使用说明

yipeiwu_com6年前PHP代码库
float类型的表示可以有以下几种:
复制代码 代码如下:

<?php
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>

使用PHP的float类型需要注意的是:PHP的float类型的精度有点问题。如果需要高精度的数学计算,可以使用php提供的专用的数学函数 arbitrary precision math functions系列和gmp系列函数。还有就是不要试图进行比较float类型的变量。

Converting to float
For information on converting strings to float, see String conversion to numbers. For values of other types, the conversion is performed by converting the value to integer first and then to float. See Converting to integer for more information. As of PHP 5, a notice is thrown if an object is converted to float.

不翻译了。呵呵

相关文章

php中get_magic_quotes_gpc()函数说明

get_magic_quotes_gpc函数是一个用来判断是否为用户提供的数据增加斜线了,这个在php.ini配置文件中哦,下面我来介绍一下get_magic_quotes_gpc()函...

php实现二进制和文本相互转换的方法

本文实例讲述了php实现二进制和文本相互转换的方法。分享给大家供大家参考。具体如下: 这段代码包含两个函数,bin2text,二进制转换为文本,text2bin,文本转换成二进制 &...

Youku 视频绝对地址获取的方法详解

前一阵子为了研究 KnLiveCommentary 而进行了一系列的关于视频站点的研究。由于KnLiveCommentary需要能够获取充足的视频源进行测试,所以我们选取了 Youku(...

php下将多个数组合并成一个数组的方法与实例代码

1.合并数组 array_merge()函数将数组合并到一起,返回一个联合的数组。所得到的数组以第一个输入数组参数开始,按后面数组参数出现的顺序依次迫加。其形式为: 复制代码 代码如下:...

解析PHP跨站刷票的实现代码

废话不多说,上代码复制代码 代码如下:function curlrequest($url, $postfield,$referer='',$cookie='') {  ////...