Skip to content

Instantly share code, notes, and snippets.

@fxm90 fxm90/isNumeric.php
Last active Apr 28, 2018

Embed
What would you like to do?
Checks whether all given parameters are numeric (Same as php-vanilla "is_numeric" but as variadic function).
// Checks whether all given parameters are numeric.
// Usage: $validCoordinates = isNumeric($_GET['p1Lat'], $_GET['p1Lon']));
function isNumeric() {
$numberOfArguments = func_num_args();
$arguments = func_get_args();
return count(array_filter($arguments, 'is_numeric')) === $numberOfArguments;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.