Skip to content

Instantly share code, notes, and snippets.

@fxm90
Last active April 28, 2018 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fxm90/7c6a3e7977cffb04935745db14b866b8 to your computer and use it in GitHub Desktop.
Save fxm90/7c6a3e7977cffb04935745db14b866b8 to your computer and use it in GitHub Desktop.
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