Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

is_float

(PHP 3, PHP 4, PHP 5)

is_float -- Finds whether a variable is a float

Описание

bool is_float ( mixed var )

Finds whether the given variable is a float.

Замечание: To test if a variable is a number or a numeric string (such as form input, which is always a string), you must use is_numeric().

Список параметров

var

The variable being evaluated.

Возвращаемые значения

Returns TRUE if var is a float, FALSE otherwise.



add a note add a note User Contributed Notes
is_float
phper
25-Jan-2006 12: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
18-Oct-2005 11: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> <is_double
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571