Whole Number | INTEGER
Syntax
INTEGER( [input], [default = 0] )
Parameters
input
Any data may be used as the input.
default optional
If input cannot be converted to an whole number, default is
returned. default must be a whole number.
Return Value
The result of the input being converted to a whole number.Description
Where possible, any value passed into this method will return a whole number. The default value is used if the input cannot be converted to a whole number. The method will return 0 if the default whole number also cannot be converted to a number.Examples
INTEGER(1) # returns 1
INTEGER(1.5) # returns 1
INTEGER("1") # returns 1
INTEGER("1.5") # returns 1
INTEGER("not a number") # returns 0
INTEGER("not a number", 1) # returns 1
INTEGER("not a number", 1.5) # returns 1
INTEGER("not a number", "not a number") # returns 0