Skip to content

Instantly share code, notes, and snippets.

@utilmind
Last active May 2, 2024 18:54
Show Gist options
  • Save utilmind/dd61906e9f2bb2d58a56008fbc7a7960 to your computer and use it in GitHub Desktop.
Save utilmind/dd61906e9f2bb2d58a56008fbc7a7960 to your computer and use it in GitHub Desktop.
is_scientific_notation in PHP
// Check, whether string is a numerical value in “scientific notation” format.
function is_scientific_notation($str) {
return !is_int($str) && !is_float($str) && is_numeric($str)
&& stripos($str, 'e') !== false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment