Skip to content

Instantly share code, notes, and snippets.

@jserle
Created May 27, 2016 20:21
Show Gist options
  • Save jserle/a03d1ad242ce8db45bf9b248ae5a3220 to your computer and use it in GitHub Desktop.
Save jserle/a03d1ad242ce8db45bf9b248ae5a3220 to your computer and use it in GitHub Desktop.
PetCheck
<?php
if (empty($argv[1])) {
die("\nPetCheck Test App\n----------------------\nType an argument after the script name"
. " to determine if it's an int or double.\n\n");
}
$in = $argv[1];
if ($in === strval(intval($in))) {
die("$in is an INT\n");
} elseif ($in === strval(floatval($in))) {
die("$in is a DOUBLE\n");
} else {
die("$in is not an INT or a DOUBLE\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment