Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: is_float - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

is_int" width="11" height="7"/> <is_double
Last updated: Thu, 31 May 2007

view this page in

is_float

(PHP 4, PHP 5)

is_float — 変数が float 型かどうか調べる

説明

bool is_float ( mixed $var )

与えられた変数が float 型かどうかを調べます。

注意: 変数が数値もしくは数値文字列の場合 (フォームからの入力の場合は 常に文字列となります) 、is_numeric() を使用する必要があります。

パラメータ

var

評価する変数

返り値

もし var が float 型 の場合 TRUE、 そうでない場合は FALSE を返します。

参考

is_bool()
is_int()
is_numeric()
is_string()
is_array()
is_object()



add a note add a note User Contributed Notes
is_float
phper
26-Jan-2006 05:08
A better way to check for a certain number of decimal places is to use :

$num_dec_places = 2;
number_format($value,$num_dec_places);
kirti dot contact at gmail dot com
19-Oct-2005 03:18
To check a float only should contain certain number of decimal places, I have used this simple function below

<?
function is_deccount($number,$decimal=2){
   
$m_factor=pow(10,$decimal);
    if((int)(
$number*$m_factor)==$number*$m_factor)
        return
true;
    else
        return
false;
 }   
?>

is_int" width="11" height="7"/> <is_double
Last updated: Thu, 31 May 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites