You are viewing an older version of the site. Click here to view
the latest version of this page. (This may be a dead link, if so, try the root page of the docs
here.)
== is_numeric ==
[[../../Optimizer#CACHE_RETURN|CACHE_RETURN]] |} === Usages ===
Copy Code
The output would be:
Copy Code
The output would be:
Copy Code
The output would be:
Copy Code
The output would be:
Copy Code
The output would be:
Copy Code
The output would be:
Returns false if the item would fail if it were used as a numeric value. If it can be parsed or otherwise converted into a numeric value, true is returned.
=== Vital Info ===
{| style="width: 40%;" cellspacing="1" cellpadding="1" border="1" class="wikitable"
|-
! scope="col" width="20%" |
! scope="col" width="80%" |
|-
! scope="row" | Name
| is_numeric
|-
! scope="row" | Returns
| boolean
|-
! scope="row" | Usages
| item
|-
! scope="row" | Throws
|
|-
! scope="row" | Since
| 3.3.0
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| [[../../Optimizer#CONSTANT_OFFLINE|CONSTANT_OFFLINE]] [[../../Optimizer#CACHE_RETURN|CACHE_RETURN]] |} === Usages ===
is_numeric(item)=== Examples === ====Example 1==== True condition Given the following code:
is_numeric('1.0')

1 {{function|is_numeric}}('1.0')
:true====Example 2==== True condition Given the following code:
is_numeric('1')

1 {{function|is_numeric}}('1')
:true====Example 3==== True condition Given the following code:
is_numeric(1)

1 {{function|is_numeric}}(1)
:true====Example 4==== True condition Given the following code:
is_numeric(1.5)

1 {{function|is_numeric}}(1.5)
:true====Example 5==== False condition Given the following code:
is_numeric('string')

1 {{function|is_numeric}}('string')
:false====Example 6==== True condition, because null is coerced to 0.0, which is numeric. Given the following code:
is_numeric(null)

1 {{function|is_numeric}}({{keyword|null}})
:true
Find a bug in this page? Edit this page yourself, then submit a pull request. (Note this page is automatically generated from the documentation in the source code.)