Skip to content

Instantly share code, notes, and snippets.

@gharabaghi
Created February 2, 2021 14:27
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 gharabaghi/9e4dee712f80464a84122c7f79df40f0 to your computer and use it in GitHub Desktop.
Save gharabaghi/9e4dee712f80464a84122c7f79df40f0 to your computer and use it in GitHub Desktop.
php- determin if a string is float or not.
public static function isFloat($numberString)
{
$regString = '/(^\d+\.\d+$|^\d+$)/';
return (bool)preg_match($regString, $numberString);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment