is_numeric() is a conditional that tests if the value passed is numeric and returns false if not.
Cons:
- Does not do any sanitization of the input value
- Will return true for values that could never or would never be a ID of a WordPress core object such as decimals (see truthy values below).
- WordPress does not consistently create false cases for testing the results of any is_numeric condition tests thus no feedback upon failure.
Values is_numeric() considered valid:
+0123.45e6
12.3456
12345
Pros:
- is_numeric allows for the creation of a false condition whereby the function testing the condition could be notified of a false condition and adjust accordingly.
- Since is_numeric is a function, it can be passed to a function as a parameter that accepts functions such as array_map(‘is_numeric’, $array) for validation purposes.