This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:intval [2017/03/31 13:43] jeff |
uphp:functions:intval [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
< | < | ||
- | Return the integer value of a number or string | + | < |
====Description==== | ====Description==== | ||
- | <well size=" | + | <well size=" |
- | <span style=" | + | <span style=" |
- | < | + | <span style=" |
+ | <span style=" | ||
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
</ | </ | ||
- | Return the integer value by truncating the fractional component of the number | + | Return the < |
====Parameter==== | ====Parameter==== | ||
- | < | + | <html><b>< |
- | ====Return | + | ====Return |
- | Integer value, or: | + | < |
* 0 on failure (for example, strings without a numeric in the leftmost characters) | * 0 on failure (for example, strings without a numeric in the leftmost characters) | ||
- | * 0 on empty arrays | + | * 0 on empty < |
- | * 1 on non-empty | + | * 1 on non-empty |
- | The maximum value possible is a signed integer in the range -2147483648 to 2147483647. | + | The maximum value possible is a signed |
====Example==== | ====Example==== | ||
- | **Convert the float ' | + | ===Convert the float ' |
<code php> | <code php> | ||
Line 42: | Line 43: | ||
The above example will output: | The above example will output: | ||
< | < | ||
- | The integer value of 1.550000 is 1 | + | The integer value of 1.550000 is 2 |
</ | </ | ||
====See Also==== | ====See Also==== | ||
- | [[floatval()]] - Return the floating point value of a number or string | + | [[floatval()]] - < |
- | [[strval()]] - Return the string equivalent of a number | + | [[strval()]] - < |
- | [[is_numeric()]] - Return 1 if the value is numeric (integer, float or numeric string) | + | [[is_numeric()]] - < |
- | [[ieee754toint()]] - Take a floating point value and return | + | [[ieee754toint()]] - < |
- | + | ||
- | [[inttoieee754()]] - Take an IEEE-754 encoded integer (32 bit) and return a float | + | |
[[uphp: | [[uphp: | ||
+ | |||
+ | ====Note==== | ||
+ | |||
+ | In firmware versions released before 8/14/17 this function returned the integer value by truncating the fractional component of the number (it did not round up or down): | ||
+ | |||
+ | < | ||