User Tools

Site Tools


uphp:functions:floatval

This is an old revision of the document!


floatval

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Return the floating point value of a number or string

Description

float floatval ( mixed $value )

Return the floating point equivalent

Parameter

$value: A string with a leading number, or a number (int or float)

Return Value

Floating point value, or:

  • 0 on failure (for example, a string without a numeric in the leftmost characters)
  • 0 on empty array
  • 1 on non-empty array

Example

Convert the integer '1' into a float variable which has a value of 1.000000:

<?
  $x=1;
  $f=floatval($x);
  print("The float value of ".$x." is ".$f);
?>

The above example will output:

The float value of 1 is 1.000000

See Also

intval() - Return the integer value of a number or string

strval() - Return the string equivalent of a number

is_numeric() - Return 1 if the value is numeric (int, float or numeric string)

ieee754toint() - Take a floating point value and return an IEEE-754 encoded integer (32 bit)

inttoieee754() - Take an IEEE-754 encoded integer (32 bit) and return a float

uPHP Variable Types and Limits

uphp/functions/floatval.1491311882.txt.gz · Last modified: 2021/09/13 05:56 (external edit)